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
gekko/strategies/indicators/DEMA.js
T
2021-06-06 20:25:14 +02:00

20 lines
479 B
JavaScript

// required indicators
var EMA = require('./EMA.js');
var Indicator = function(config) {
this.input = 'price';
this.result = false;
this.inner = new EMA(config.weight);
this.outer = new EMA(config.weight);
}
// add a price and calculate the EMAs and
// the result
Indicator.prototype.update = function(price) {
this.inner.update(price);
this.outer.update(this.inner.result);
this.result = 2 * this.inner.result - this.outer.result;
}
module.exports = Indicator;