IsNaN ( double value);


The IsNaN function returns true if the specified parameter is not a number and false otherwise.

Input parameters

Parameter Default value Description
value - Defines value to test.

Example 1

def onExpansion = if IsNaN(close) then yes else no;
plot HighestClose = if onExpansion then HighestAll(close) else double.NaN;
plot LowestClose = if onExpansion then LowestAll(close) else double.NaN;

This example code draws the highest and the lowest close  price on the right expansion of the subgraph (see the image below). For more information about the chart expansion, please refer to the Time Axis article.

Example 2

declare lower;

input symbol = "IBM";
def closeSymbol = close(symbol);
def closeSymbolWithoutNaN = CompoundValue(1, if IsNaN(closeSymbol) then closeSymbolWithOutNaN[1] else closeSymbol, closeSymbol);
plot Data = closeSymbolWithOutNaN;

This code plots the close price of an input symbol across the current chart. Any gap in the input symbol price data (NaN value) is replaced with the last-known close price value before the gap.