This repository has been archived on 2025-10-29. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
2021-06-06 20:25:14 +02:00

31 lines
795 B
JavaScript

var method = {};
// Prepare everything our method needs
method.init = function() {
this.name = 'tulip-adx'
this.trend = 'none';
this.requiredHistory = this.tradingAdvisor.historySize;
this.addTulipIndicator('myadx', 'adx', this.settings);
}
// What happens on every new candle?
method.update = function(candle) {
// nothing!
}
method.log = function() {
// nothing!
}
method.check = function(candle) {
var price = candle.close;
var adx = this.tulipIndicators.myadx.result.result;
// console.dir(adx)
if(this.settings.thresholds.down > adx && this.trend !== 'short') {
this.trend = 'short';
this.advice('short');
} else if(this.settings.thresholds.up < adx && this.trend !== 'long'){
this.trend = 'long';
this.advice('long');
}
}
module.exports = method;