Skip to content
FreeFinance

Moving averages

An average of the last n closes, recomputed each period. It smooths, and smoothing costs lag — the two are the same operation seen from opposite sides, and no choice of n escapes the trade-off.

Chapter 5 · Intermediate

The most widely used indicator there is, and the easiest to state precisely.

The simple moving average

The arithmetic mean of the last n closing prices, recomputed each period:

SMAn=1n∑i=0n−1Pt−i\text{SMA}_n = \frac{1}{n}\sum_{i=0}^{n-1} P_{t-i}

Each day the oldest close drops out and the newest enters. That is the whole definition.

Two properties follow immediately and neither is a matter of opinion.

It is smoother than the price. Averaging reduces variance. That is what an average does.

It lags the price. The mean of the last fifty closes includes prices from up to fifty days ago, so it reflects where price has been rather than where it is.

These are the same fact. Smoothing is lag. You cannot have one without the other, and no amount of refinement escapes it — because the information you are suppressing to get smoothness is recency.

The exponential moving average

The common response to lag is to weight recent prices more heavily:

EMAt=αPt+(1−α) EMAt−1,α=2n+1\text{EMA}_t = \alpha P_t + (1-\alpha)\,\text{EMA}_{t-1}, \qquad \alpha = \frac{2}{n+1}

Each new value is a blend of today's close and yesterday's EMA, so older observations decay geometrically rather than dropping out abruptly.

This reduces lag and reduces smoothing by exactly the same amount. It does not solve the trade-off; it moves along it. An EMA responds faster and is therefore noisier — which is the cost, and it is often presented as though it were a free improvement.

A further consequence worth knowing: because each EMA value depends on the previous one, an EMA never fully forgets. Every close you ever fed it retains a vanishing weight. An SMA forgets completely at n periods.

The window is a free parameter

Nothing in the data specifies n. 10, 20, 50, 100 and 200 are conventions, not findings — they are round numbers in a decimal system, and markets have no reason to respect them.

This is chapter 2's problem again, and chapter 3's, and it matters more here because the parameter space is larger. Each choice of n produces a different series, and so does each choice of interval from chapter 2, and so does each choice of which price to average.

The research literature names exactly this hazard: a dataset can be repeatedly used to search over families of trading systems, markets, estimation periods and model assumptions, and successful results found that way "may be spurious because they could be obtained just by chance."

So "the 50-day works well on this stock" is not a finding about the stock. It is the outcome of a search over window lengths, and a search over enough windows will find one that fits any history.

What a moving average is good for

Stated descriptively, with no trading implication:

It makes the shape of a long series readable. On a decade of noisy daily closes, a long average shows the broad path. That is a presentation benefit and a real one.

It is a reference for how far price sits from its recent mean, which is a quantity you might want for other purposes — the Measuring your return subject's volatility discussion, for instance.

It is a well-defined, reproducible number. Unlike chapter 4's visual patterns, two people computing a 50-day SMA on the same closes get the same answer. That is why this family of methods is what the research in chapter 9 is able to test.

Working the problem

A 50-day moving average said to have "caught the trend".

How much can one new close move it? The SMA is a mean of fifty values. Adding a new close and dropping the oldest changes the mean by:

Δ=Pnew−Pdropped50\Delta = \frac{P_{\text{new}} - P_{\text{dropped}}}{50}

So a new close ₹100 above the one leaving the window moves the average by ₹2. A single day, however dramatic, shifts a 50-day average by one-fiftieth of its surprise.

What that implies about "catching" a trend. For the average to turn upward and keep rising, price must stay elevated for a substantial number of days — roughly, enough new closes above the departing ones to accumulate. In practice a 50-day average does not begin to reflect a new direction until something like ten to twenty-five sessions have passed, depending on how large the move is relative to the prices leaving the window.

By the time the average has "caught" the trend, a large part of the move has already happened. That is not a defect of this particular average; it is arithmetic. A mean of fifty numbers cannot respond quickly to one of them, and if it did, it would not be smooth, and if it were not smooth it would offer nothing over the price itself.

The honest conclusion: a moving average tells you where price has been relative to its recent history. It is a summary of the past with a known delay, and the delay is calculable in advance from n. It is not a forecast, and a shorter window buys responsiveness by surrendering the only thing the average was providing.

And the "caught the trend" claim is almost always made after the fact — identified by looking back at a chart where a trend is visible and observing that the average eventually sloped the same way. It had to. Chapter 8 is about how much of this subject consists of that move.

The point

A simple moving average is the mean of the last n closes and an exponential one weights recent closes more heavily, with each new EMA value blending today's price into yesterday's — so it never fully forgets while an SMA forgets abruptly at n periods. Smoothing and lag are the same operation, so no refinement escapes the trade-off; an EMA only moves along it. One new close shifts a 50-day average by a fiftieth of its surprise, which means a substantial part of any move has occurred before the average reflects it. And n is a free parameter, so a window that fits one history is the product of a search rather than a property of the instrument.

Check yourself

4 questions. Every answer is explained afterwards, including the ones you get right — guessing correctly is not the same as knowing. Score 70% or more and the chapter is marked done.

Question 1 of 4

MarketsHard
What distinguishes an exponential moving average from a simple one?

0 of 4 answered. You can submit with questions unanswered — they simply score zero.

Now do it with your own numbers

A 50-day moving average is said to have "caught the trend" in a stock. Work out roughly how far the price must have moved before the average could reflect it, and say what that implies about what a moving average can tell you.

The average includes 50 closes. Ask how much a single new close can shift a mean of fifty.

Sources