Skip to main content

Quant Analytics: from scratch to pro · Indicators, honestly measured · Beginner

Moving averages and their lag

A moving average smooths prices by averaging the recent past. The smoothing always comes at a price: the average is late. This lesson shows how simple and exponential averages are built, how large the delay is, and why a longer window means a later signal.

4 min read Reviewed Revision 1

In this lesson

  • Compute a simple moving average and an exponential moving average by hand
  • Convert a window length n into the smoothing factor alpha = 2 / (n + 1)
  • Estimate the lag of an average as (n - 1) / 2 periods
  • Explain why smoother means later, and why averages cannot be judged by how they look on a chart

Read first: Reading a price chart

Weight on each past price: SMA(10) against EMA(10)

  • SMA(10)
  • EMA(10)
0% 5% 10% 15% 20% 03691215 Age of the price (periods back, 0 = latest)
Weight. Computed from the definitions, not from market data. The simple average weights ten prices equally and then drops the rest. The exponential average weights the latest most and never fully forgets.

Worked numbers

Each result is recomputed from the formula shown.

WhatFormulaResult
SMA(5) on the first five closes(100 + 102 + 101 + 104 + 106) / 5102.6
SMA(5) on the last five closes(105 + 103 + 107 + 109 + 108) / 5106.4
smoothing factor for n = 52 / (5 + 1)0.333
EMA on day 6, seeded with the first SMAalpha * 105 + (1 - alpha) * sma_a103.4
EMA on day 7alpha * 103 + (1 - alpha) * ema6103.27
EMA on day 8alpha * 107 + (1 - alpha) * ema7104.51
EMA on day 9alpha * 109 + (1 - alpha) * ema8106.01
EMA on day 10alpha * 108 + (1 - alpha) * ema9106.67
smoothing factor for n = 102 / (10 + 1)0.1818
lag of a 20-period average(20 - 1) / 29.5
lag of a 200-period average(200 - 1) / 299.5
weight of each price in SMA(10)1 / 1010%
share of EMA(10) weight beyond the latest 10 prices(1 - alpha10)**1013.4%

Check yourself

Closes of 105, 103, 107, 109, 108. What is the 5-period simple moving average?

(105 + 103 + 107 + 109 + 108) / 5 = 106.4.

What smoothing factor does a 10-period EMA use?

alpha = 2 / (10 + 1) = 0.1818, so the latest price gets about 18.2% of the weight.

A price rises by exactly 1 each day. How far behind is a 20-day simple average?

(20 - 1) / 2 = 9.5 days, which is 9.5 points below the latest price.

A 200-day average is smoother than a 20-day average. What do you give up?

Timeliness. The lag is 99.5 periods instead of 9.5. A smoother line reacts later.

Does an EMA have less lag than an SMA of the same n?

Not on a steady trend: with alpha = 2 / (n + 1) both lag by (n - 1) / 2. The EMA puts more weight on recent prices, so it reacts faster to a sudden move, but it also keeps a long tail of older prices.

Key terms

Moving averageExponential moving averageTimeframeCandlestick

Sources

Informational content. Not investment advice.