Module 4 · Lesson 4 of 12 · Volume and indicators · About 5 minutes

Moving Averages in Depth: SMA, EMA, Lag and Crossovers

On this page
  1. What you will learn
  2. How is a simple moving average calculated?
  3. How is an exponential moving average different?
  4. Why do moving averages lag?
  5. What does a crossover describe?
  6. Moving average diagram
  7. How else are moving averages used?
  8. What this does not tell you about moving averages
  9. Method in Practice
  10. Check yourself
  11. Reflect on your own process
  12. Sources

Before you read: Technical Indicators Explained: MA, RSI, MACD, Bollinger, ATR

What you will learn

How is a simple moving average calculated?

If you wanted one number to describe where price has been lately, how would you pick it?

A simple moving average (SMA) adds the last N closing prices and divides by N. Each new bar adds the newest close and drops the oldest one, so the average “moves” along the chart.

Example. A fictional stock closes at $10, $11, $12, $11 and $13 over five days. The 5-day SMA is (10 + 11 + 12 + 11 + 13) ÷ 5 = $11.40. If the next close is $14, the $10 drops out and the new SMA is (11 + 12 + 11 + 13 + 14) ÷ 5 = $12.20.

Every close in the window counts equally. That makes the SMA easy to understand, but it also means a large old price has full weight until the day it drops out, which can make the line jump for reasons that have nothing to do with today.

How is an exponential moving average different?

Should yesterday’s price count more than a price from three weeks ago?

An exponential moving average (EMA) gives more weight to recent prices. Each new value is a blend of the newest close and the previous EMA:

EMA today = previous EMA + k × (close − previous EMA), where k = 2 ÷ (N + 1).

For a 9-period EMA, k = 0.2, so each new close moves the average 20% of the way toward it. Older prices never fully drop out; their weight just fades. The EMA usually reacts faster than an SMA of the same length, and it also reacts faster to noise, though not every EMA turn comes before every SMA turn. Other variants, such as weighted and smoothed moving averages, use different weighting schemes on the same idea.

Why do moving averages lag?

Can an average of the past ever be ahead of the present?

Any average of past prices trails the latest price. A longer window smooths more and lags more:

  • A 10-period average responds within a few bars and changes direction often.
  • A 200-period average responds slowly and changes direction rarely.

There is no length that is both smooth and fast. The common lengths, such as 9, 20, 50 and 200, are conventions. Their popularity means many people see the same lines, which can make them reference points, but that does not give any length a special property.

What does a crossover describe?

When a fast line crosses a slow line, what has price actually done?

A crossover happens when a shorter moving average crosses a longer one. A short average crossing above a long one shows that recent prices have risen above the longer-run average. Some traders call a 50-day average crossing above a 200-day average a “golden cross”, and the reverse a “death cross”. The names are dramatic; the event is arithmetic.

Two things follow from the lag:

  • By the time a crossover appears, much of the move that caused it has already happened.
  • In a sideways market, the averages tangle together and cross back and forth repeatedly, a pattern often called whipsaw.

Crossovers summarize a change in the recent average. They do not show that a new trend has started.

Moving average diagram

A fast and a slow moving average turning after a fictional low. A fictional price turns up from a low; the fast average turns soon after, the slow average later, and the crossover comes well after the turn. Illustrative diagram constructed for teaching. Not real market data.

Illustrative diagram constructed for teaching. Not real market data.

The diagram shows a fictional price path that turns up from a low. A fast moving average turns soon after the low; a slow one turns later, and the crossover appears well after the turn. It is constructed for teaching and is not real market data.

Try it on a chart

  1. This chart shows a simple and an exponential moving average. Find a place where they cross.
  2. Notice which line turns first after price changes direction.

TradingView Advanced Real-Time Chart

TradingView chart. Showing it connects your browser to TradingView, which may set cookies or store settings and similar identifiers in your browser.

Privacy details

Charts and quotes are TradingView's data, not ours, and may be delayed.

Open the full practice chart

How else are moving averages used?

Besides crossovers, where do traders look at a moving average?

Common uses include describing direction (is the average rising or falling?), measuring distance (how far is price from its average?) and marking dynamic support or resistance, where traders note how price behaved near a widely watched average. VWAP is a related idea that weights each price by volume and resets each session.

What this does not tell you about moving averages

  • No moving average length is best. Testing many lengths on the same data and picking the winner is overfitting.
  • A crossover does not show that a trend will continue.
  • Different platforms can show slightly different values, depending on the price used (close, typical price) and how the first value is seeded.
  • Nothing here is a signal to buy or sell.

Method in Practice: a trend filter, and the whipsaw

Fictional example. John, Harbor Index futures, the prices, times, costs and results are all invented for teaching. This shows how a written plan can be built and tested. It is not a recommendation, and nothing here says how often this idea works.

Try it on a real chart. Look at the chart in this lesson, then test this idea yourself on past sessions with bar replay. Keep your own count, including the days with no trade.

The idea. A moving average lags price, and no length is "best" (this lesson). John uses one only as a filter: he looks for longs only when price is above a rising 50-period average on 30-minute bars. The failed replay shows the whipsaw, where price crosses the average and comes back.

John's plan

Setup
a 30-minute close above the 50-period SMA, and the SMA higher than it was 10 bars ago
Enter if
with the filter on, a 30-minute period closes above the prior period's high. Buy.
Wrong if
a 30-minute period closes below the 50-period SMA
Manage
take half at entry + 0.60, the rest at entry + 1.20 or by 14:30. One trade per day
Risk
$150 maximum, costs included (1 contract if the SMA is more than 0.65 below the entry)

Three outcomes

  • Worked: the trend continued → +$170

  • Failed (whipsaw): a close below the average, then back above an hour later → −$100, inside the limit

  • No trade: price was above the average, but the average wasn't rising → $0

Show the full replays
ItemPlan
Context (filter)50-period SMA of 30-minute closes. On when the last close is above it and it's higher than 10 bars ago
Entry conditionFilter on, and a 30-minute period closes above the prior period's high. Buy 2 at market after that close
Wrong ifA 30-minute period closes below the SMA. Exit at market after that close
ManagementTake profit on half at entry + 0.60 (limit) and move the exit for the rest to the entry price (stop). Rest at entry + 1.20 (limit). Time limit 14:30 CT. One trade per day
Risk cap and size$150. Planned cost per contract = (entry − SMA + 0.05) × $100 + $5. 2 contracts when the SMA is within 0.65 of the entry, otherwise 1
Not trading ifScheduled major release within the hour, or no setup by 12:00 CT

Replay A: worked

Time (CT)What happenedJohn
09:30–10:00Closes 101.10, above the prior high of 101.05. SMA 100.65 and risingCondition met: buys 2 at market, filled 101.15. SMA 0.50 below, so 2 contracts
10:00–11:30Trades 101.75 at 11:30Sells 1 at 101.75 (limit). Exit for the other moves to 101.15
11:30–13:40Never back to 101.15, trades 102.35 at 13:40Sells the last 1 at 102.35 (limit)

Result after costs: +0.60 point = +$60, +1.20 points = +$120, commissions −$10. Net +$170. Journal: "Filter on, entry rule met, the trend kept going."

Replay B: failed (whipsaw)

Time (CT)What happenedJohn
10:00–10:30Closes 101.35, above the prior high of 101.30. SMA 101.05 and risingBuys 2 at market, filled 101.40
10:30–11:00Closes 101.00. SMA 101.06Wrong-if met: sells 2 at market, filled 100.95
11:00–12:00Closes back above the SMA at 11:30 and 12:00One trade per day: done

Result after costs: 2 × −0.45 point = −$90, commissions −$10. Net −$100. Journal: "Below the average for one bar, then back above. That's the whipsaw the lag creates. The one-trade rule kept it to one loss."

Replay C: no trade

Time (CT)What happenedJohn
09:30–10:00Closes 100.80, above the SMA (100.60), but the SMA is lower than 10 bars agoFilter off
10:00–12:00Two closes above prior highsFilter still off: no trade. 12:00 cutoff

Result: $0. Journal: "Price above a flat-to-falling average. My filter needs both conditions."

Test it yourself

Where it breaks

  • Every moving average lags. In a range, price crosses it again and again (the failed replay).
  • "Rising" depends on the lookback you chose.
  • A filter doesn't make the entry good. It only removes some days.

Calculators: position sizerisk/rewardexpectancy

Reflection question: Where did the moving-average length in your plan come from, and is that written down?

Check yourself

  1. Five closes are $20, $22, $21, $23 and $24. What is the 5-period SMA? Hint: add them and divide by five.
  2. What is k for a 19-period EMA? Hint: 2 ÷ (N + 1).
  3. Why do crossovers often appear after much of a move has already happened? Hint: both lines are averages of the past.

Reflect on your own process

For your own notes; there is no score and no right answer.

  1. Which moving-average lengths appear in your written plan, and what record shows where those numbers came from?
  2. If you tested several lengths before choosing one, does your journal record how many you tried?
  3. How does your checklist describe a crossover without turning it into a reason by itself?
  4. Where did the moving-average length in your plan come from, and is that written down?

Sources

Last reviewed . Spotted a mistake? Report an error.