Exponential Moving Average Function

An exponential moving average (EMA), sometimes also called an exponentially weighted moving average (EWMA), applies weighting factors which decrease exponentially. The weighting for each older data point decreases exponentially, giving much more importance to recent observations while still not discarding older observations entirely

Base Syntax

The base syntax requires XAVG( with no spaces followed by a formula returning a numeric value, followed by a comma, followed by a positive integer number (this cannot be a formula), followed by a closing parenthesis.

You can actually but in a non-integer number for the period, but it will be converted to a positive integer.

Past Values

There is no syntax built into the XAVG() function to designate a bars ago parameter or date. Any bars ago parameters or dates need to be included in the syntax for the formula used as the first argument.


XAVG(wx) -> Exponential Moving Average - Returns the x period exponential moving average of w.

The arguments in functions are separated by commas.

Where w can be any formula which returns a numeric value.

Where x is the period of the function being applied to w.