CS2203
error Comparing with na is always false; use na(name) instead.
#What it means
Comparing a value with na using == or != is always false, because any comparison involving na is false. The check you meant needs the na() function.
#Typical cause
x == naorx != na.
#How to fix it
Write na(x) to test for "no value", and !na(x) for "has a value". The editor offers this as a quick fix.
#Example
//@chartscript 1
indicator("Average or close", { overlay: true })
const avg = ta.sma(close, 50)
plot(avg == na ? close : avg)Fixed
//@chartscript 1
indicator("Average or close", { overlay: true })
const avg = ta.sma(close, 50)
plot(na(avg) ? close : avg)