The Simple Moving Average is the arithmetic mean of the last N closing prices.
Common periods: 20 (short-term), 50 (medium), 200 (long-term).
Death Cross: 50-day crosses below 200-day → bearish.
Limitations: equal weighting means SMA lags price — old data has the same influence as new data.
Five-day SMA on day 15: the last five closes are 104, 102, 99, 101 and 104, so (104 + 102 + 99 + 101 + 104) / 5 = 102.0. The average peaked at 107.0 on day 9, two days after the highest close (109 on day 7) — the lag the averaging pays for its smoothness.
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 |
- Lag: the average turns only after enough of the window has turned, so crossover signals arrive late and give back part of the move.
- Whipsaw in sideways markets: price crosses the average back and forth, and each cross is a losing trade.
- An old price leaving the window moves the average as much as a new one entering it, so the line can jump on a day when nothing happened.
df['sma5'] = df['close'].rolling(5).mean()
Assumes import numpy as np, import pandas as pd, and a DataFrame df with columns high, low, close and volume — the 15 days above.
- W. Brock, J. Lakonishok & B. LeBaron, “Simple Technical Trading Rules and the Stochastic Properties of Stock Returns”, Journal of Finance 47(5), 1992 — moving-average rules on the Dow, 1897–1986
- R. Sullivan, A. Timmermann & H. White, “Data-Snooping, Technical Trading Rule Performance, and the Bootstrap”, Journal of Finance 54(5), 1999 — the same rules after correcting for testing many of them; the edge does not hold out of sample
Last reviewed October 2026 · How this site checks its content · Report a mistake
1. Roughly how far does a 20-day simple moving average lag the price?
Show answer
C. The average sits at the centre of its window, which is (n − 1) / 2 days in the past.
2. What is a “golden cross”?
Show answer
A. The death cross is the opposite. Both are slow signals because both averages lag.
3. Why can an SMA move although today’s price did not change?
Show answer
B. This “drop-off effect” is one reason exponential averages, which never drop values abruptly, are used instead.
- LLM EngineeringFine-TuningTurning a base model into a helpful assistant
- ML MathCNNExploiting spatial structure with shared local filters
- ML MathLinear RegressionFitting a line through data — the simplest predictive model
- Timeseries EngineeringARIMAThe workhorse of classical forecasting
- Timeseries EngineeringFeature EngineeringTurning raw timestamps into predictive signals