how to solve comparison of boolean value to float value?

Viewed 23
//@version=5
strategy("MACD")

[macdline,signalline,histog]=ta.macd(close,12,26,9)

ema200 = ta.ema(close,200)

long =  signalline > macdline
short=  signalline < macdline

start=timestamp(2021,1,1,0,0,0)
end=timestamp(2021,6,1,0,0,0)

if ta.crossover(long,ema200)
    strategy.entry("long",strategy.long,100,when=long)
    strategy.entry("short",strategy.short,100,when=short)

strategy.close("long",when=short)
strategy.close("short",when=long)

I get that I cannot compare the boolean value to a number value, but I cannot find a solution to this, can anyone help to get through this problem? and sorry if it is hard to read my code I am new to this

0 Answers
Related