StockEducation
The advanced course

Chapter 26 · Moving Averages

Moving averages

SMA, EMA, WMA, VWMA and HMA — the formulas, worked on the same closes, with the lag quantified.

45 of 66 · 11 min

A moving average against price

pricemoving averagethe average lags by construction
The average smooths the noise and shows direction, but it is computed from prices that have already happened — so it always turns after price does.

A moving average replaces each close with an average of the last n closes. It removes short-term movement so a direction is visible. Everything it gains in smoothness it pays for in lag, and the whole art is choosing where on that trade-off to sit.

The formulas

TypeFormulaCharacter
SMA(P₁ + P₂ + … + Pₙ) ÷ nEvery close weighted equally
EMAEMAtoday = (Price × k) + (EMAyesterday × (1 − k)), where k = 2 ÷ (n + 1)Recent closes weighted more; nothing ever fully drops out
WMAΣ(Pᵢ × wᵢ) ÷ Σwᵢ, with weights 1, 2, … nLinear decline in weight
VWMAΣ(Price × Volume) ÷ Σ VolumeWeighted by how much traded, not by when
HMAWMA over √n of (2 × WMA(n/2) − WMA(n))Built to cut lag while staying smooth
Golden crossA short MA crossing above a long MAConventional bullish signal
Death crossA short MA crossing below a long MAConventional bearish signal

Worked: SMA and EMA on the same numbers

Five closes: 410, 414, 409, 421, 426.

  • SMA(5) = (410 + 414 + 409 + 421 + 426) ÷ 5 = 2,080 ÷ 5 = 416.0.
  • Seed the EMA with that same 416.0, and take k = 2 ÷ (5 + 1) = 0.3333.

A sixth close arrives at 433.

CalculationResult
SMA(5)(414 + 409 + 421 + 426 + 433) ÷ 5420.6
EMA(5)(433 × 0.3333) + (416.0 × 0.6667)421.7

The EMA is higher because it gives the new close a third of the weight. The SMA gives it a fifth and drops the oldest close entirely — which is a real effect people forget: an SMA can fall on a day the price rises, purely because the number leaving the window was large.

Lag, quantified

An SMA of n periods is centred roughly (n − 1) ÷ 2 periods in the past. A 200-day average is describing where the middle of the last 200 days sat — about 100 days ago. A 20-day average lags by about 10 days.

That is not a defect to be engineered away. It is what smoothing means. Every low-lag average — HMA, DEMA, TEMA, Kaufman's adaptive average — buys responsiveness by giving up smoothness, and therefore whipsaws more. There is no free version.

Which length, for which job

SettingCommon useThe question it answers
200-day SMAPrimary trend filterIs the long-term trend up?
50-day SMAIntermediate trend filterIs the medium-term trend up?
20-day EMADynamic support in a strong moveWhere do pullbacks tend to stop?
10-day EMAShort-term momentumIs the current push still intact?
50 / 200 pairGolden and death crossesHas the regime changed?
Ribbon (several at once)Compression and expansionIs the market undecided or committed?

Golden cross and death cross

golden crossdeath cross50-day (short)200-day (long)the cross happens after the turn, never before it
A short average crossing a long one. Both are averages of the same closes, so the cross is confirmation of a move that already happened, not a signal ahead of it.

What a golden cross really is

A 50-day average cannot cross above a 200-day average until 50 days of closes have already risen enough to drag it there. By construction, the cross arrives well after the turn. It is a confirmation that a regime changed, not a forecast that one is about to. Anyone selling it as an entry signal is selling you the tail of a move.

Saved in this browser only — there is no account to create. Clearing your browser data clears your progress.