The Exponential Moving Average applies an exponential smoothing factor that weights recent prices more heavily.
EMA = (Close − EMA_prev) × k + EMA_prev
Because each new EMA is built on the previous, all past prices influence the result — but their weight decays exponentially.
More responsive than SMA to sudden price changes — preferred in faster-moving markets.
Five-day EMA, so k = 2 / (5 + 1) = 1/3. On day 14 the EMA is 101.80; day 15 closes at 104, so EMA = 101.80 + (104 − 101.80) × 1/3 = 102.53. That is already above the five-day SMA (102.0): today’s close carries a third of the weight.
The example data: 15 days, used in every indicator here
| Day | High | Low | Close | Volume |
|---|---|---|---|---|
| 1 | 101 | 99 | 100 | 50,000 |
| 2 | 103 | 100 | 102 | 62,000 |
| 3 | 103 | 100 | 101 | 48,000 |
| 4 | 105 | 101 | 104 | 70,000 |
| 5 | 108 | 104 | 107 | 85,000 |
| 6 | 108 | 105 | 106 | 60,000 |
| 7 | 110 | 106 | 109 | 90,000 |
| 8 | 110 | 107 | 108 | 72,000 |
| 9 | 108 | 104 | 105 | 80,000 |
| 10 | 105 | 102 | 103 | 66,000 |
| 11 | 105 | 102 | 104 | 55,000 |
| 12 | 104 | 101 | 102 | 75,000 |
| 13 | 102 | 98 | 99 | 95,000 |
| 14 | 102 | 99 | 101 | 64,000 |
| 15 | 105 | 101 | 104 | 71,000 |
- It still lags, only less: it reacts faster than the SMA but still turns after the price has.
- Faster also means noisier — more crossovers, and more false ones, in a choppy market.
- The starting value matters. Seeded from the first close (as here) or from a simple average, the first values differ until the old weight has faded.
df['ema5'] = df['close'].ewm(span=5, adjust=False).mean() # k = 2/(5+1)
Assumes import numpy as np, import pandas as pd, and a DataFrame df with columns high, low, close and volume — the 15 days above.
- J. S. Hunter, “The Exponentially Weighted Moving Average”, Journal of Quality Technology 18(4), 1986 — the same smoother in industrial process control
- Technical Analysis of the Financial Markets, J. J. Murphy, New York Institute of Finance, 1999
Last reviewed October 2026 · How this site checks its content · Report a mistake
- Pattern EssaysHow Long Is Memory?Every model decides how much the past matters, usually with a number nobody looks at
- Market PsychologyRecency BiasWeighting recent events more heavily than historical ones.
- ML MathOptimizersBeyond vanilla SGD — momentum, adaptive learning rates, Adam
- ML MathRNNProcessing sequences by passing hidden state through time
- Timeseries EngineeringExponential SmoothingWeighted averages that fade the past