I'm designing a strategy, but i keep getting this error on 2 lines of code.
I'm not quite sure how to get around it.line 77: The function 'crossover' should be called on each calculation for consistency. It is recommended to extract the call from the ternary operator or from the scope.
line 82: The function 'crossunder' should be called on each calculation for consistency. It is recommended to extract the call from the ternary operator or from the scope.
the code is this:
All help is welcome!//check macd uptrend in the 4 hr
[macdLine, signalLine, histLine] = macd(close,macdshortP,macdlongP,macdsignalP)
[highermLine, highersLine, higherhline]=security(syminfo.tickerid, macdres,[macdLine, signalLine, histLine], barmerge.gaps_off, barmerge.lookahead_off )
gtrend=highermLine-highersLine
//CHECK IF THE THREE CANDLES BEFOR OF THE SIGNAL WERE BELOW OR ABOVE THE BASIS
isabove=close[3]>basis
isbelow=close[3]<basis
//strategy entry
longCondition = (isbelow ? (crossover(close, basis) ? gtrend>=0 : false) : false)
if (longCondition)
ep:=close
strategy.entry("Long", strategy.long)
shortCondition = (isabove ? (crossunder(close, basis) ? gtrend<0 : false) : false)
if (shortCondition)
ep:=close
strategy.entry("Short", strategy.short)
Despite the error, the strategy is running.
Thank you all