first commit
This commit is contained in:
commit
aa7869eb33
386 files changed
+69375
No files matched your search
@@ -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;
|
||||
Reference in new issue
Block a user