nz

Takes a value and an alternative of the same type, and stands in for the value where it is absent. Five overloads, one per data type. The alternative is optional; what is substituted when you leave it out is not stated by the contract, so pass one where the answer matters.

nz(series bool value, series bool alt) → series bool
nz(series color value, series color alt) → series color
nz(series float value, series float alt) → series float
nz(series int value, series int alt) → series int
nz(series string value, series string alt) → series string
ParameterTypeRequiredDescription
valueseries boolyesThe value to check. Required.
altseries boolnoThe alternative to use in its place. Optional, and of the same data type as the value.

Returns series bool or series color or series float or series int or series string — A value of the same data type as the arguments: series bool, series color, series float, series int or series string.

indicator("Delta, zero where absent")
plot(nz(orderflow.delta, 0))

See also values and types

Part of the function index.

Ready to put this into practice?
Try GoCharting Premium
Unlock advanced orderflow, market profile, options desk, and real-time data — everything you just read about, live in your charts.
Upgrade