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

+34
View File
@@ -0,0 +1,34 @@
var method = {};
method.init = function() {
this.name = 'Triple Moving Average';
this.requiredHistory = this.settings.long;
this.addIndicator('short', 'SMA', this.settings.short)
this.addIndicator('medium', 'SMA', this.settings.medium)
this.addIndicator('long', 'SMA', this.settings.long)
}
method.update = function(candle) {
this.indicators.short.update(candle.close)
this.indicators.medium.update(candle.close)
this.indicators.long.update(candle.close)
}
method.check = function() {
const short = this.indicators.short.result;
const medium = this.indicators.medium.result;
const long = this.indicators.long.result;
if((short > medium) && (medium > long)) {
this.advice('long')
} else if((short < medium) && (medium > long)) {
this.advice('short')
} else if(((short > medium) && (medium < long))) {
this.advice('short')
} else {
this.advice();
}
}
module.exports = method;