The Exponential Moving Average indicator smooths the source data with an ever-decreasing exponent. The weighting for each older data point decreases exponentially, never reaching zero.
EMA myEMA50 = new EMA(bars.Close, 50); EMA myEMA200 = EMA.Series(bars.Close, 200);
First, an exponent value is calculated:
exponent = 2 / (period + 1)
The first EMA value is then assigned to the first value in the source TimeSeries. Subsequent values are calculated using this formula:
EMA = exponent * (source data - previous EMA) + previous EMA
EMA is interpreted in the same way as the Simple Moving Average (SMA). Since EMA is more sensitive to recent data values, it typically responds more quickly to changes in the underlying source data.
The chart below lets you see how the EMA compares to the SMA. Use the slider to change the period of both moving averages and see the results update on the chart dynamically.