Created
October 4, 2018 04:07
-
-
Save askmike/42ac6986587abbf1b24cf1321a70876d to your computer and use it in GitHub Desktop.
expsoing this.advice in a gekko strat
This file contains hidden or 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
// option 1: | |
const otherFunction = (candle, advice) => { | |
// your other function | |
// example: | |
if(something) { | |
advice('long'); | |
} | |
} | |
start.check = (candle) => { | |
// whenever you call otherFunction simply pass the advice function | |
otherFunction(candle, this.advice) | |
} | |
// ------- | |
// option 2: | |
const otherFunction = () => { | |
// your other function | |
} | |
strat.init = function() { | |
this.otherFunction = otherFunction.bind(this); | |
// and now use this.otherFunction | |
// it has access to this.advice | |
} | |
// ------ | |
// option 3: | |
strat.init = function() { | |
this.otherFunction = () => { | |
// your other function | |
} | |
} | |
strat.check = function() { | |
this.otherFunction(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment