Skip to content

Moving average: calculation, uses and limits

A moving average smooths a price series over a sliding window; span, weights and alignment determine what it shows and how quickly it responds.

Immediate definition

In plain terms — A moving average takes a short section of prices, calculates their average, and repeats the calculation as the window slides forward. The result is smoother than price, but it is not a forecast.

A ten-close simple average adds ten closing prices and divides by ten. On the next bar, a new value enters and the oldest leaves; that is why the average “moves.” The span is the number of bars in the window. Its meaning depends on the timeframe: 20 hourly bars and 20 weekly bars represent very different horizons.

How it is calculated

For a simple moving average with span N, the current value is SMA_t = (P_t + P_{t-1} + ... + P_{t-N+1}) / N. Every observation has equal weight. A weighted average uses declared weights; an EMA, or exponential moving average, progressively reduces the weight of older observations. SMA and EMA are not interchangeable: with the same stated span they react and decay differently.

Moving average Low-pass filter on price MA
The average dampens short variations. A longer span produces a smoother line, but responds less quickly to recent changes.

The input must also be stated. Closing price, typical price, volume, or another series produce different outputs. “20 MA” without the type, input and timeframe is an incomplete specification.

How to read and use it

The line's slope describes the direction of the smoothed movement. The gap between price and average shows how far the current value is from its recent baseline. Crossings between price and an average, or between a fast and a slow average, can form trading rules, but they have no universal meaning. Rules based on those crossings may maintain directional exposure during a persistent trend; in a sideways market they may instead alternate rapidly and incur repeated costs.

The familiar lag follows from smoothing: the line combines several observations and therefore changes more slowly than price. A short span tracks recent changes more closely but retains more noise; a long span smooths more and reacts later. The choice should match the analytical question, not merely the most attractive historical result.

Centred average and sample edge

The average on an operational chart is often trailing: it contains the current and earlier data, so it reaches the latest bar. A centred moving average assigns each result to the middle of its window. With an odd span N = 2k + 1, it needs k observations before and k after the estimated point; the final k bars remain unavailable until future observations arrive. With an even span, the centre falls between periods and requires an additional centring convention.

This distinction prevents a common error. A centred line can describe the historical section well, but it is not automatically available in real time. The Hurst inverse moving average is a specialised historical use of a centred average and retains this exact endpoint limitation.

Advanced checks

A moving average is a filter, not a perfect wall between “noise” and “trend.” Span and weights determine its response to different frequencies, and components near the cutoff may be only partly attenuated. A reproducible calculation fixes the formula, input data, missing-value handling and calculation time. A useful check repeats it with nearby spans and observes how much the reading depends on that single parameter. If a conclusion changes when the span moves from 20 to 21 bars, the rule is sensitive to its specification. Choosing a span because it follows one historical section well describes that section; it does not establish how it will behave on the next.

Sources