hi,
i'm trying to write a simple formula and am getting hung up. basically, all i'm trying to achieve is:
var MACD = study.getValue(MACDStudy.MACD);
if (MACD(-1 //yesterday)) < 0 && (MACD( //current bar)) > 0
// buy
If found a good starter script which I'm trying to modify:
var MACD = study.getValue(MACDStudy.MACD);
var Signal = study.getValue(MACDStudy.SIGNAL);
if(Signal < MACD && !Strategy.isLong())
Strategy.doLong("Long", Strategy.MARKET, Strategy.NEXTBAR);
i'm trying to write a simple formula and am getting hung up. basically, all i'm trying to achieve is:
var MACD = study.getValue(MACDStudy.MACD);
if (MACD(-1 //yesterday)) < 0 && (MACD( //current bar)) > 0
// buy
If found a good starter script which I'm trying to modify:
var MACD = study.getValue(MACDStudy.MACD);
var Signal = study.getValue(MACDStudy.SIGNAL);
if(Signal < MACD && !Strategy.isLong())
Strategy.doLong("Long", Strategy.MARKET, Strategy.NEXTBAR);
Comment