Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update STOCH.js #4

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Update STOCH.js #4

wants to merge 3 commits into from

Conversation

bgh91
Copy link

@bgh91 bgh91 commented Jul 12, 2018

Getting the same values as Tradingview.
Make sure the time zone is correct on tradingview to compare.
When the exchange data fails Tradingview cut out the data that is missing but gekko just freezes and all the numbers go to the same for close, high and low candle. Then causes the K and D numbers to NaN, stopped this with - if (candle.high !== candle.low).
Added Smooth K, set to 1 to disable
Takes 5-6 candles for K % D calculations to catch up initially ?? not sure how to correct this

Test with:

var method = {};

method.init = function() {

this.name = "Tradingview-tester";

this.addIndicator('ind', 'STOCH', {KPeriods: 5, DPeriods: 3, smoothKPeriods :2});

};

method.check = function() {};
method.update= function(candle) {

console.log("Time: " + candle.start.format())
console.log("High : " + candle.high);
console.log("Low : " + candle.low);
console.log("Close : " + candle.close);
console.log("LL : " + this.indicators.ind.getLowest());
console.log("HH : " + this.indicators.ind.getHighest());
console.log("%K: " + this.indicators.ind.K);
console.log("%D: " + this.indicators.ind.D);
console.log();

};
method.log = function() {};

module.exports = method;

bgh91 added 3 commits July 12, 2018 16:02
Getting the same values as Tradingview.
Make sure the time zone is correct on tradingview to compare. 
When the exchange  data fails Tradingview cut out the data that is missing but gekko just freezes and all the numbers go to the same for close, high and low candle. Then causes the K and D numbers to NaN, stopped this with - if (candle.high !== candle.low).
Added Smooth K, set to 1 to disable
Takes 5-6 candles for K % D calculations to catch up initially ?? not sure how to correct this

Test with:

var method = {};

method.init = function() {

    this.name = "Tradingview-tester";

    this.addIndicator('ind', 'STOCH', {KPeriods: 5, DPeriods: 3, smoothKPeriods :2});

};

method.check = function() {};
method.update= function(candle) {

    console.log("Time: " + candle.start.format())
    console.log("High : " + candle.high);
    console.log("Low : " + candle.low);
    console.log("Close : " + candle.close);
    console.log("LL : " + this.indicators.ind.getLowest());
    console.log("HH : " + this.indicators.ind.getHighest());
    console.log("%K: " + this.indicators.ind.K);
    console.log("%D: " + this.indicators.ind.D);
    console.log();
};
method.log = function() {};

module.exports = method;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant