Navigation: Realtest Script Language > Syntax Element Details > SkipNans Category General-Purpose Functions Description Evaluate a multi-bar function using only non-NaN values within the specified lookback period Syntax SkipNans(expression) Parameters expression - any formula, typically a multi-bar function Examples SkipNans(MA(data_value, 20)) If the *data_value* array has 3 NaNs in the past 20 bars, calculate the average of the 17 non-NaN values. SkipNans(Median(if(C > C[1], C/C[1]-1, nan), 100) Calculate the median up-day gain from in the past 100 days. In this example we deliberately supply NaN to the Median formula on down days. Without SkipNans this would cause the Median to be returned as NaN. SkipNans can be used in this way to calculate any multi-bar function for a deliberate subset of the lookback bars. Copyright © 2020-2026 Systematic Solutions, LLC