first commit

This commit is contained in:
Francois Klieber committed 2021-06-06 20:25:14 +02:00
commit aa7869eb33
386 files changed
+69375

No files matched your search

+19
View File
@@ -0,0 +1,19 @@
// 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;