SMA and EMA: moving averages explained
Compare a simple average with exponential smoothing and learn about lag.
Calculation
A 20-period SMA is the arithmetic mean of the last 20 closes. An EMA applies recursive weighting: EMA today = α × close + (1 − α) × EMA yesterday, with α = 2/(N+1). The initial EMA convention can vary.
Example
For N=9, α is 0.2. If the preceding EMA is 100 and the new close is 105, the new EMA is 101. The chart contrasts a 9-period EMA and 20-period SMA using the same sample.
Use in context
A rising average reflects prior prices. Crossovers are observations about smoothed data; they are not independent forecasts. A faster average generally reacts sooner and may be noisier.
Common mistakes
Use equal bar intervals, allow warm-up bars, and avoid using tomorrow’s price in today’s average. Compare any test against simple alternatives and transaction costs.
