Skip to content

What a moving average is

Reading the chart

What a moving average is

A moving average is a line that runs across a price chart without being a price. Each point on it is one number: the arithmetic mean of a stated count of recent closing prices, worked out again every time another bar closes. Everything else said about moving averages, the smoothing, the lag, the crossings, follows from that single sentence of arithmetic.

8 min read, Reviewed

What you will be able to do

  • Calculate a simple moving average from a short price series
  • Explain the difference in weighting between a simple and an exponential average
  • Explain why every moving average lags by construction
  • State what a crossing of two averages describes and what it does not

The calculation, in full 

A stated count of the most recent closing prices is added together, and the total is divided by how many were added. That is the entire operation, and it is the one performed in a classroom on a set of test marks. When the next bar closes, the newest close joins the group and the oldest leaves it, the addition and the division run again, and the result is plotted at the bar that just closed. The word moving refers to the window rather than to the arithmetic: the mean is an ordinary mean, and what moves is the stretch of chart it is taken over.

Which price goes into the sum is part of the definition rather than a detail. The close is the conventional input, on the reasoning met earlier in this module that a close is the one price at which trading in a period came to rest. Others are in common use: the high, the low, the midpoint of the bar's range, or the mean of the high, the low and the close, which charting tools usually call the typical price. Each produces a different line on identical data, so an average is not fully specified until its input price is stated alongside its length.

Key term

Simple moving average (SMA)
A simple moving average is the mean of a fixed number of recent closing prices, recalculated as each new period ends, which smooths a series by giving every price in the window equal weight.
Worked example. Illustrative figures, not YAL prices or terms.

A five period simple average, and the step that follows it

Closes in the window, oldest to newest
100.00, 101.00, 102.00, 101.00, 103.00
Sum of the five closes
507.00
Sum divided by five
101.40, the value plotted at the newest bar
Close of the next bar
104.00
Close leaving the window
100.00, the oldest one
New sum, 507.00 less 100.00 plus 104.00
511.00
New sum divided by five
102.20
Change in the average across the step
0.80

Round illustrative figures chosen so the arithmetic can be checked by hand. No instrument is named, because the calculation is identical on every instrument and every timeframe. No profit or loss is computed here and no cost is involved.

One feature of that table carries through the rest of the lesson. The new value depended on two prices only, the one that arrived and the one that left, while the closes in the middle carried straight across and cancelled out of the change. So an average can move sharply on a bar whose close barely differed from the previous one, if the close falling out of the far end of the window happened to be an extreme. Charting literature calls that the drop out effect, and it is a property of the window rather than a response to anything occurring now.

The lookback is a setting, not a property of the market 

Nothing in any market fixes how many closes belong in the window. It is a setting, chosen by whoever is drawing the line, and the lengths in general circulation, ten, twenty, fifty, one hundred and two hundred periods, are round numbers inherited from an era of hand drawn charts rather than quantities derived from anything. A shorter window tracks price closely and changes direction often. A longer window ignores most of what price does between its ends and changes direction rarely. These are not a better and a worse version of one measurement, in the same way that the confirmation setting behind a swing point was not: they are measurements of different stretches of time.

Key term

Moving average
A moving average is the average of a fixed number of recent prices, recalculated on every new bar, which smooths a price series by lagging it.

One consequence is visible at the left of every chart. A window cannot be filled until enough closes exist to fill it, so an average has no value at all for the bars before that and the line simply starts later than the chart does. Where two lengths are drawn together, the pair does not exist until the longer has filled.

Simple, weighted and exponential 

The simple average gives every close inside the window exactly the same weight, and every close outside it a weight of nothing. Both halves of that are strong assumptions rather than neutral ones. A close from the far end of the window counts as heavily as the one that printed a moment ago, and the close sitting one bar outside counts for nothing whatsoever, despite being a single period older than one that counts in full.

Two variants adjust that. A weighted moving average keeps the fixed window but scales the closes inside it linearly, the newest counting most, which softens the drop out effect without removing the hard edge of the window. An exponential moving average removes the window altogether. It is calculated recursively: a fraction of the newest close is added to the remaining fraction of the previous value of the average itself. Because that previous value already contained the one before it, and so on backwards, no close is ever discarded completely, and its weight decays geometrically towards nothing without reaching it.

The fraction applied to the newest close is called the smoothing factor, and it is conventionally derived from a stated period so that an exponential average can be spoken of as having a length at all. Most charting tools use two divided by the stated period plus one. That is a convention rather than a property of the object: other factors are in use, and since an exponential average has no window, its stated period names the formula behind its smoothing factor rather than a count of bars it reads.

Key term

Exponential moving average (EMA)
An exponential moving average smooths a price series while weighting recent observations more heavily than older ones, so it turns faster than a simple average of the same length.
Worked example. Illustrative figures, not YAL prices or terms.

One update of an exponential average, beside the simple weight

Assumed stated period
9 periods
Smoothing factor, 2 divided by (9 plus 1)
0.20
Weight the exponential average puts on the newest close
0.20
Weight a 9 period simple average puts on the newest close
0.1111, that is one ninth
Previous value of the exponential average
101.00
Newest close
104.00
New value, 101.00 plus 0.20 × (104.00 less 101.00)
101.60
Weight still carried by every earlier close combined
0.80

The smoothing factor formula shown is the common charting convention and is assumed here rather than being a property of the market. The period is an assumption too, chosen because it divides cleanly. Round illustrative figures, no instrument named, no profit or loss computed, no cost involved.

Reading the two weights together states the difference precisely. At the same stated length the exponential average responds to the newest close nearly twice as strongly as the simple one, and it has no drop out effect, because nothing ever leaves. The price of that is on the last row: an exponential average carries a residue of every close ever fed into it, including prices from conditions that have long since ended, so the value it reports is not a statement about a stretch of chart that can be pointed at.

Why every moving average lags 

An average of past closes cannot contain a price that has not printed, so the delay is not an imperfection in a particular implementation. It is the definition. The value plotted at the newest bar is computed from a stretch of prices whose centre sits back in time, roughly halfway back through the window for a simple average, and it is drawn at the end of that stretch. The line at the right hand edge is a description of the middle of the window, plotted at its end.

There is a second and more mechanical way to see the same thing. For a simple average, the change from one period to the next equals the difference between the arriving close and the departing close, divided by the lookback. A move in price is divided by the length of the window before any of it reaches the line, which means the longer the window the smaller the share of any move that shows up in the next value of the average.

Worked example. Illustrative figures, not YAL prices or terms.

One jump in price, two lookbacks

Every close before the jump
100.00
Value of both averages before the jump
100.00
The one close that jumps
110.00, a move of 10.00
3 period average after that close
103.33, a move of 3.33
10 period average after that close
101.00, a move of 1.00
Closes at 110.00 needed before the 10 period average reads 110.00
10
Closes at 110.00 needed before the 3 period average reads 110.00
3

A flat series with a single step in it, chosen so the arithmetic is checkable in one line: the change in a simple average is the size of the move divided by the lookback. Round illustrative figures, no instrument named, no profit or loss computed, no cost involved.

The last two rows are the trade off in its bluntest form. Shortening the window reduces the delay and admits more of the variation the average was drawn to remove; lengthening it removes more variation and increases the delay. The two move together, always, and no weighting escapes the relationship: an exponential average reaches a new level in fewer periods than a simple one of the same stated length, which is a smaller delay rather than none, because it too is computed from closes that have already printed.

Key term

Lagging indicator
A lagging indicator reports a change only after it has already occurred, because every value it prints is computed from data that has already been published or prices that have already traded.
No moving average, of any length and any weighting, contains information about a price that has not yet printed. Every value on the line is a restatement of prices already on the chart. The point drawn at the newest bar is also incomplete while that bar is still open, because the close it needs does not exist yet, so the end of the line moves until the bar closes and then stops.

What a crossing of two averages describes 

Two averages of different lengths drawn on one series will meet from time to time, and the meeting is an arithmetic event with an exact meaning. At the moment of a crossing, the mean of the closes in the shorter window equals the mean of the closes in the longer one. Immediately after it, the shorter mean sits on the other side of the longer mean, which says that recent closes as a group have moved above, or below, the level that closes over the longer stretch averaged out to. That is a statement in the past tense about prices that have already printed, and it is the whole of what the geometry asserts.

Key term

Golden cross
A golden cross is recorded when a shorter moving average crosses above a longer one on the same chart, a crossing chart readers conventionally treat as a change of trend.

Trend following traditions attach names to particular crossings, a shorter average moving above a longer one being conventionally called a bullish crossover and the reverse a bearish one, and commentary has its own nicknames for the crossings of a few long standing lengths. Those traditions disagree with one another about what a crossing implies, and their own literature notes the structural point the lag section arrived at: a crossing occurs after the move that produced it, necessarily, because both lines are computed from the closes that made the move. Some treat that delay as the cost of filtering, others as fatal to the construction, and the arithmetic settles neither position, being identical for both.

It is worth being equally exact about what a crossing does not describe. It says nothing about how far price has travelled, since two averages can cross on a move of any size. It says nothing about how long anything has been in progress, since a crossing of two short averages and a crossing of two long ones mark different amounts of elapsed time. And it says nothing whatsoever about the next period, because neither line contains a price from it.

Where the description breaks down 

The condition under which a moving average describes a market poorly is not an unusual one. It is a range, which is one of the two states covered earlier in this module. Within a range, price oscillates around a level, so the mean of the recent closes settles near the middle of the range and price crosses it repeatedly in both directions without either side persisting. Two averages of different lengths behave the same way with respect to each other: they converge, cross, cross back, and cross again. The repeated crossing and re crossing is what practitioners mean by whipsaw.

Whipsaw is not a malfunction, and describing it as one misplaces the problem. The average is doing exactly what its definition requires: reporting the central tendency of recent closes, in a market whose closes are clustered around a centre. Every account of what a crossing means presumes that closes are moving away from their own mean rather than returning to it, and when they are returning to it, crossings still occur, in quantity. The arithmetic gives no indication of which of the two situations produced any particular crossing.

  • A step change in price. After a gap, or an abrupt repricing of any kind, a simple average spends the whole of its lookback carrying closes from before the change, and reports a level that trading has already left. It stops doing so only once every pre change close has fallen out of the window.
  • Session breaks and data conventions. An average computed across a break averages closes drawn from different sessions. Where providers define a session differently, or fill a non trading period differently, the closing prices differ, so the same stated average on the same instrument differs between two screens.
  • The timeframe it is drawn on. An average of a stated length covers hours on an hourly chart and months on a daily one, so a length quoted without its timeframe, and without its input price, names no particular line on any particular chart.

Where practitioners disagree 

The first disagreement is between the simple and the exponential average, and it is older than the software that draws them. One camp holds that the exponential version describes a current market more closely, because it weights the newest close most heavily and cannot jump on the departure of a stale one. The other holds that the simple version is preferable precisely because it is crude and widely shared, and that the drop out effect is not an artefact but an old price genuinely leaving a window it no longer belongs in. No measurement settles this, because the two summarise different sets of prices under the same name.

The second disagreement is larger and reaches past this lesson. One tradition treats a widely watched average as a level in its own right, describing price approaching it as a point of interest and arguing that enough participants watching one line can make it self confirming. Critics of that view answer that the lengths in common use were inherited rather than derived, that a search across many lengths on past data will always turn up one that appears to have fitted, and that a fit found in past prices says nothing about the next period. The narrow statement both sides accept is the one this lesson has been building towards: an average is a restatement of prices that have already printed, and it carries no information about prices that have not.

In summary 

  • A moving average is the mean of a stated count of recent closes, recalculated when each new bar closes. The window slides, the arithmetic does not change, and the line is a series of those means plotted at the bar each was computed on.
  • A simple average weights every close in its window equally and everything outside it not at all. An exponential average weights the newest close most and decays the rest geometrically, so it has no window and never fully discards a price.
  • Lag is built into the definition rather than added by an implementation. A move in price is divided by the lookback before it reaches a simple average, so a longer window means a smoother line and a slower one, and neither weighting nor length removes the delay.
  • A crossing of two averages states that recent closes have moved above or below their level over a longer stretch. It describes prices already printed, it occurs after the move that produced it, and in a range it occurs repeatedly in both directions.

Get started

Open your account in four steps.

A clear path from sign-up to your first trade, in four steps.

No depositNo documents

  1. 01/ 04step 1 of 4

    Register

    A few details to get started.

    No deposit to open

  2. 02/ 04step 2 of 4

    Verify

    Confirm your identity, securely.

    ID and proof of address

  3. 03/ 04step 3 of 4

    Fund

    Add money by bank transfer or card.

    From $0

  4. 04/ 04step 4 of 4

    Trade

    Go live on the platform you already know.

    MetaTrader 5

Cookies on this site

Some cookies are needed to make the site work. With your permission we also use analytics cookies to see which pages are read, so we can improve them. You can change your choice at any time.