- Null (Null/Nan/Infinity) to zero

Miscellaneous functions
(AmiBroker 4.30)

SYNTAX Nz( x, valueifnull = 0 )
FUNCTION Converts Null/Nan/Infinity values to zero (or user defined value)

x can be number or array.

You can use the Nz function to return zero, or another specified value when argument x is Null or Nan or Infinite.

For example, you can use this function to convert a Null (empty) value to another value and prevent it from propagating through an expression. If the optional valueifnull argument is included, then the Nz function will return the value specified by that argument if the x argument is Null (or Nan or Infinity).

EXAMPLE You can use the Nz function as an alternative to the IIf function.

Instead of:

varTemp = IIf( IsFinite( (H-L)/(C-L) ), (H-L)/(C-L), 0 );

You can write:

varTemp = Nz( (H-L)/(C-L) );



The Nz function is used in the following formulas in AFL on-line library:

More information:

See updated/extended version on-line.