Moving Average
Also known as: rolling average, running mean, smoothing.
Replacing each point of a series with the average of the points around it, to smooth short-term noise. A longer window smooths more but reacts later.
Synthetic dataExamples on this page use synthetic data created for illustration.
Definition
A moving average replaces each point in a series with the average of the points around it, smoothing short-term noise so that the underlying trend is easier to see. A longer window smooths more but reacts later to real change.
In plain terms
A trailing average uses the latest several points up to today; a centred average uses points on both sides. The window length is a trade-off: a short window follows the data closely and stays noisy, a long one is smooth and slow.
A centred average uses future values, so using it to build a signal that is supposed to be known “today” is Look-ahead Bias. For anything meant to run in real time, use the trailing version, and remember it lags.
Example
Seven daily values with a one-day spike: 10, 12, 9, 40, 11, 10, 13. Three-day trailing average:
| Day | Value | 3-day trailing average |
|---|---|---|
| 3 | 9 | 10.3 |
| 4 | 40 | 20.3 |
| 5 | 11 | 20.0 |
| 6 | 10 | 20.3 |
| 7 | 13 | 11.3 |
The single spike on day 4 now lifts the smoothed series for three days. Smoothing reduces noise, but it also spreads real events out in time and delays the signal.
Common misunderstandings
- “A moving average predicts the future.” It summarises the past; it lags rather than leads.
- “The window length does not matter.” It decides how much noise is removed and how late changes are seen.
- “Trailing and centred averages are interchangeable.” The centred one uses the future and cannot be used live.
References
- Rob J. Hyndman, George Athanasopoulos. Forecasting: Principles and Practice, section 3.4: Moving averages . OTexts, 2021.
- NIST/SEMATECH e-Handbook of Statistical Methods . NIST.