Navigation: Realtest Script Language > Syntax Element Details >








Controls what happens when there are not enough bars to calculate a simple average or indicator


True - calculate simple averages and indicators using how ever many bars are available

False - return NaN if not enough bars are available


If UseAvailableBars is not specified in a script then the value from the Settings Panel will be used.

When UseAvailableBars is False (the default), then any simple average or indicator that does not have enough data to calculate the correct value will return NaN (not a number), and the formula will stop being evaluated.

When UseAvailableBars is True, simple averages and indicators are calculated using however many bars are available. For example, if a formula refers to Avg(C,200) and the current bar is only the 100th bar of the data for that symbol, then the 100-day average close will be returned instead.

The UseAvailableBars setting has no effect on exponential averages or indicators. Exponential average calculation actually requires five times the "length" to reach full precision. RealTest will use this full-precision length when it is available, and will use however many bars are available otherwise. Unlike simple averages, however, this does not change the "length" parameter, which is really just the denominator of the fraction used to multiply each new value by the prior result during calculation. So for exponential averages, having too few bars available has a less significant impact on the result than it does for simple averages.

See also Number of Bars Required.




Copyright © 2020-2021 Systematic Solutions, LLC