Mismatched input '=' expecting 'end of line without line continuation' (PS5)

Viewed 14

I'm working on a simple test strategy in PineScript 5 and having some trouble with an error I'm getting. It's blaming the problem on the first 'if' statement line. Any help would be appreciated. I've checked other solutions but my case seems to be a little different.

longCondition=ta.crossover(close, usdt_rsmi)

shortCondition=ta.crossunder(close, usdt_rsmi)
    

if longCondition=true,
     strategy.entry("Enter Long", strategy.long)
    
if shortCondition=true,
     strategy.entry("Enter Short", strategy.short)
1 Answers

You should use == for comparision and there should be no comma at the end.

if longCondition == true
    strategy.entry("Enter Long", strategy.long)
    
if shortCondition == true
    strategy.entry("Enter Short", strategy.short)
Related