Documentation/AlgoCode/Function reference

replaceMissing

Replace na with a number or the same bar of another series.

Reference/Math & comparisons/Function

replaceMissing(series, replacement)

na is not available: the indicator does not have enough bars yet (ema(50) is na for the first 49 bars). replaceMissing fills those gaps so comparisons do not stay false forever. A series replacement uses that bar only. Shorthand: nz(series, replacement).

Parameters

NameTypeDescription
seriesseriesInput that may be na.
replacementoptionalnumber
default 0
Number or series used on bars where the input is na. A series replacement is read on that same bar only — never a future bar.

Return value

series

Also accepted: nz.

Example

plot replaceMissing(rsi(14), 50) as "RSI"

See also