The value that means no value; assigning it clears a variable and any calculation using it returns na.
na is the Pine placeholder for a missing number, string, colour or object. Any arithmetic with na gives na, comparisons with na are false, and a plot that receives na draws a gap.
Never test for it with x == na, which is always false. Call na(x), or replace a missing value with nz(x) or fixnan(x).
Type
simple na
Remarks
- Indicators start with na until they have enough bars.
ta.sma(close, 20)is na on the first 19 bars. - You can assign na to a variable of any type, as in color c = na or label lb = na.
Example
//@version=6
indicator("Hide the quiet bars")
value = close > open ? close - open : na
plot(value, "Up body", color.green, style = plot.style_columns)
plot(na(value) ? 1 : 0, "Gap flag", display = display.data_window)See also
Runs on Sidechair