Attachments forums

List of attachments posted on this forum.


All files on forums: 135270

Tiki Stochastic Indicator

heispark, Tue Jan 04, 2022 9:52 pm

This is called 'Tiki Stochastic' which is an indicator made for Tradovate platform. Can anyone port this to MT4? user named Medici uses it and it looks impressive. He uses (10,13,3) weighted.
EDIT:
I found its Java code:

Code: Select all

const predef = require("./tools/predef");
const meta = require("./tools/meta");
const MovingHigh = require("./tools/MovingHigh");
const MovingLow = require("./tools/MovingLow");
const SMA = require("./tools/SMA");
const EMA = require('./tools/EMA');
const WMA = require('./tools/WMA');
const MMA = require('./tools/MMA');
const HMA = require('./HMA');

const ma = {
    sma: SMA,
    ema: EMA,
    wma: WMA,
    mma: MMA,
    hma: HMA
};

class tikiStochastic {
    init() {
        this.highest = MovingHigh(this.props.kPeriod);
        this.lowest = MovingLow(this.props.kPeriod);
        this.kMA = ma[this.props.type](this.props.smoothPeriod);
        this.dMA = ma[this.props.type](this.props.dPeriod);
    }

    map(d) {
        const high = d.high();
        const low = d.low();
        const close = d.close();
        const hh = this.highest(high);
        const ll = this.lowest(low);
        const c1 = close - ll;
        const c2 = hh - ll;
        const fastK = c2 !== 0 ? c1 / c2 * 100 : 0;
        const K = this.kMA(fastK);
        const D = this.dMA(K);
        return { 
            K, 
            D, 
            overBought: this.props.overBought,
            overSold: this.props.overSold
        };
    }

    filter(d) {
        return predef.filters.isNumber(d.D);
    }
}

module.exports = {
    name: "tikiStochastic",
    title: "Tiki Stochastic",
    description: "Tiki Stochastic",
    calculator: tikiStochastic,
    params: {
        kPeriod: predef.paramSpecs.period(10),
        dPeriod: predef.paramSpecs.period(10),
        smoothPeriod: predef.paramSpecs.period(3),
        overBought: predef.paramSpecs.period(80),
        overSold: predef.paramSpecs.period(20),
        type: predef.paramSpecs.enum({
            sma: 'Simple',
            ema: 'Exponential',
            wma: 'Weighted',
            mma: 'Modified',
            hma: 'Hull'
        }, 'sma')
    },
    validate(obj) {
        if (obj.period < 1) {
            return meta.error("kPeriod", "K Period should be a positive number");
        }
        if (obj.period < 1) {
            return meta.error("dPeriod", "D Period should be a positive number");
        }
        if (obj.smoothPeriod < 2) {
            return meta.error("smoothPeriod", "Smooth period should be greater than 1");
        }
        return undefined;
    },
    inputType: meta.InputType.BARS,
    areaChoice: meta.AreaChoice.NEW,
    plots: {
        K: { title: "%K" },
        D: { title: "%D" },
        overBought: { title: "Over Bought" },
        overSold: { title: "Over Sold" }
    },
    tags: ['Tiki Tools'],
    schemeStyles: {
        dark: {
            K: predef.styles.plot("cyan"),
            D: predef.styles.plot({
                color: "red",
                lineWidth: 2
            }),
            overBought: predef.styles.plot("yellow"),
            overSold: predef.styles.plot("yellow"),
        },
        light: {
            K: predef.styles.plot("blue"),
            D: predef.styles.plot({
                color: "red",
                lineWidth: 2
            }),
            overBought: predef.styles.plot("orange"),
            overSold: predef.styles.plot("orange"),
        }
    }
};
The following is /NG 5M chart:
All files in topic