Page 1 of 1

Error in trading

Posted: Fri May 28, 2021 2:05 pm
by golias
Hey there traders.
I'm designing a strategy, but i keep getting this error on 2 lines of code.
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.
I'm not quite sure how to get around it.
the code is this:
//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)
All help is welcome!
Despite the error, the strategy is running.

Thank you all