Handle data that is not there. A missing number is na, a float NaN, as in Pine; missing strings, colours and objects are null.
- Arithmetic with
na gives na, and every comparison with it is false, including na === na.
isNa(x) tests for it; nz(x, replacement) replaces it, with 0 by default.
- A plot set to
na draws nothing on that bar: a line breaks there unless it says join: true.
- An indicator updated with
na follows TradingView’s rule for that indicator.
Because comparisons with na are false, test for the condition you want rather than its opposite:
Missing strings, colours and objects
Anything that is not a number is null when it is missing: a market input left on the chart’s own, a colour input that follows the theme, the wallet on a Lighter liquidation. Check before using one, as for any nullable value in TypeScript:
A colour of null passed to a plot’s set means the plot’s own colour, not none; use color.none to draw nothing on that bar.
In state and history
A series bar that was never set reads na, and so does ago(n) before the first bar. A state.bar(na) cell is a common way to mean “not known yet”: the first bar that knows the value writes it, and every bar after reads it.
Where data starts
Each stream has a start: trades the start of the UTC day before yesterday, liquidations 7 days back, the order book 2026-03-10. Before it, a stream’s available is false and its values are na. Check available before using a stream, so older bars stay empty instead of showing zeros:
Next step
Bring scripts from TradingView with Pine Script. Last modified on October 16, 2026