Created
January 21, 2019 12:40
-
-
Save soerenmartius/cb26c73b424d8d946c8b38995722f19d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Let's create our own strategy | |
var strat = {}; | |
// Prepare everything our strat needs | |
strat.init = function () { | |
this.addIndicator('longHMA', 'HMA', this.settings.long); | |
this.addIndicator('shortHMA', 'HMA', this.settings.short); | |
} | |
// Based on the newly calculated | |
// information, check if we should | |
// update or not. | |
strat.check = function (candle) { | |
const shortSignal = this.indicators.shortHMA.result; | |
const longSignal = this.indicators.longHMA.result; | |
// go long if daily close is above the hma80 | |
if (candle.close > longSignal) { | |
this.advice('long'); | |
} | |
// go short if daily close is above the hma55 | |
if (candle.close < shortSignal) { | |
this.advice('short'); | |
} | |
} | |
module.exports = strat; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello can i see your HMA calculator ?