What is the Exponential Moving Average (EMA)? Definition, Formula, and Example
The exponential moving average (EMA) is a weighted moving average that applies exponentially decreasing weights to older prices, making it respond faster to recent price changes than a simple moving average.
What is the Exponential Moving Average?
The exponential moving average (EMA) is a trend-following indicator that averages prices while weighting recent data more heavily than older data. Where a simple moving average (SMA) gives every bar in the lookback window equal weight, the EMA assigns each prior bar a weight that decays by a constant factor. The result: the EMA turns sooner when price reverses and hugs price closer during trends, at the cost of more whipsaws in chop.
How the EMA Is Calculated
The EMA is computed recursively:
- Multiplier (smoothing constant): k = 2 / (N + 1), where N is the period
- EMA today: EMAₜ = (Priceₜ × k) + (EMAₜ₋₁ × (1 − k))
For a 20-period EMA, k = 2/21 ≈ 0.0952 — today's price gets a 9.52% weight, and yesterday's EMA retains 90.48%. The calculation is seeded with an SMA of the first N bars, then runs recursively. Because the recursion never fully discards old data, an EMA technically carries influence from every bar in the series, though the weight of ancient bars decays toward zero. Common periods: 9 and 21 (short-term), 50 (intermediate), 200 (long-term trend).
Worked Example: AAPL 9-EMA
Assume AAPL closes at $230.00 and yesterday's 9-EMA sits at $226.50. With N = 9, k = 2/10 = 0.20:
EMA = (230.00 × 0.20) + (226.50 × 0.80) = 46.00 + 181.20 = $227.20
The next day AAPL drops to $224.00:
EMA = (224.00 × 0.20) + (227.20 × 0.80) = 44.80 + 181.76 = $226.56
Note the two-day behavior: the EMA rose $0.70 on the up day and fell $0.64 on the down day, tracking price far tighter than a 9-SMA would. A day trader using the 9-EMA as a trend filter sees price close back above the EMA at $226.56 as the trigger to stay long; a close below flips the bias short.
When Traders Use the EMA
The EMA serves three core functions. Trend filter: price above a rising 50-EMA means long-only; below a falling 50-EMA means short-only or flat. Dynamic support/resistance: in strong trends, pullbacks repeatedly bounce off the 9- or 21-EMA, giving low-risk entries with a stop just beyond the line. Crossover systems: the 9/21 EMA cross drives countless momentum systems, and the 50/200 cross defines the golden cross and death cross. The EMA also underpins other indicators — MACD is literally the difference between the 12- and 26-period EMAs.
Limitations and Common Misconceptions
The EMA is a lagging indicator by construction — it confirms trends, it does not predict them. In sideways markets, price slices back and forth through short EMAs, generating repeated false signals; no period length fixes this. A common misconception is that a "faster" EMA is strictly better: shortening the period increases responsiveness and whipsaw in equal measure. Another: the EMA is not a magnet. Price does not "owe" a return to the EMA; extended trends can run far above the 21-EMA for weeks. Finally, EMA values differ slightly across data providers because the recursive seed depends on how much history is loaded.