Here is my Pinescript code. Problem is, I have the following error : Cannot use a mutable variable as an argument of the security function. Do you have any idea how I could use my boolean variable toz in the security() function ?
TD = 0
TS = 0
if close > close[4]
TD := TD[1]+1
if close < close[4]
TS := TS[1]+1
TDUp = TD - valuewhen(TD < TD[1], TD , 1 )
TDDn = TS - valuewhen(TS < TS[1], TS , 1 )
bool toz = (TDDn==9) //or (TDDn==9)
customFunc() => toz
s1 = security('BTCUSD', 'D', customFunc())