Navigation: Realtest Script Language > Syntax Element Details >

EMA or XAvg






Multi-Bar Functions


Exponential Moving Average


EMA(expr, count) or XAvg(expr, count)


expr - data series formula

count - lookback period


Either EMA or XAvg can be used as the name of this function.

Count is usually thought of as an integer representing a number of bars, but can actually be any decimal value. An EMA is constructed by multiplying each difference between the result so far and the next value by a factor equal to 2 / (count + 1).

Note that, like most other backtesting software, RealTest begins each EMA calculation with MA(expr, count), then begins to apply the EMA weighting for subsequent bars once count has been reached.

This function supports one-pass calculation when used in the Data Section with a non-variable count.





Copyright © 2020-2024 Systematic Solutions, LLC