STRATEGY LIBRARY · TREND FOLLOWING · 1 OF 5

Moving-average crossover

Buy when a faster moving average crosses above a slower one, sell when it crosses back: the simplest trend filter there is.

STRATEGY PROFILE~15–20 MINUTES
Style
Trend following
Horizon
Swing to position (weeks to months)
Typical markets
Liquid futures in any asset class
Data you need
Daily closes
Difficulty
Beginner

Why it might work

Prices in many markets show some persistence: moves that have begun tend to continue a little more often than chance would suggest, possibly because information is absorbed gradually and positioning builds over time. A moving average smooths noise, and a fast average above a slow one is a simple, mechanical definition of an uptrend.

The crossover will not catch tops or bottoms. Its job is to be in the market's direction for most of a large move and to step aside when the move ends.

When it works, and when it struggles

It works best when markets make long, sustained moves. It struggles in ranges, where the averages cross back and forth and each crossover is a small loss (whipsaw).

Early academic tests on stock indices found simple moving-average rules informative, but later work showed much of that result weakening once data snooping and later periods were accounted for. Treat it as a building block to test, not a known edge.

The rules, written so they can be tested

Setup
Compute the 20-day and 50-day simple moving averages of daily closes.
Entry
When the 20-day closes above the 50-day, buy at the next open. Reverse for shorts.
Stop
Initial stop 2 × ATR(20) below entry, placed with the order.
Exit
Close the position at the close of the day the 20-day crosses back below the 50-day.
Size
Risk a fixed fraction of equity (for example 0.5%) using the stop distance.
WORKED EXAMPLE
Moving-average crossover on synthetic daily S&P 500 futuresDaily candles with 20- and 50-day averages. A buy marker where the 20-day crosses above the 50-day, and an exit where it crosses back below.4,800.005,000.005,200.00BuyExitInitial stop 4,781.5020-day SMA50-day SMASYNTHETIC DATA · ILLUSTRATION ONLY
Synthetic daily bars. 20-day and 50-day simple moving averages of closes.

On bar 52 the 20-day average closed above the 50-day average. The rule buys at the next open, bar 53, at 4,853.25.

The initial stop is 2 × ATR(20) below entry. ATR was 35.89 points, so the stop is 4,781.50: 71.75 points, or $717.50 for 2 MES contracts.

The averages crossed back down on bar 123 and the position was closed at that day's close. The trade was closed at 5,000.75 on bar 123: 147.50 index points per contract, $1,475 on 2 MES before costs, or 2.06R.

Notice how late both signals are. The crossover bought well after the low and sold well after the high. That lag is the price of filtering out noise, and it is why crossovers lose in choppy markets.

How it fails

  • Range-bound markets produce repeated false crossovers.
  • Signals are late by construction; a sharp V-shaped reversal can turn a winning trade into a loser before the exit triggers.
  • Optimising the two lengths on one market's history is a classic overfitting trap; the best pair rarely stays best.

Test it yourself

  • Test a broad grid of fast/slow lengths and look for a plateau of reasonable results, not a single peak.
  • Test across many unrelated markets and decades; a trend rule that works in one market only is suspect.
  • Count whipsaw losses and the longest stretch without a new equity high; decide in advance whether you could live through it.

Common variants

  • Exponential instead of simple averages (faster to react).
  • Price-versus-average rules (close above the 200-day).
  • Triple-average filters that require alignment.

Watch for this misconception

Thinking a crossover predicts a trend. It only reports that a trend has probably started; most crossovers fail to become large moves.

PRACTICE EXERCISE

Pick a market and count how many 20/50 crossovers occurred over the last two years and how many led to moves larger than 2 × ATR.

Chart trainer ↗
KNOWLEDGE CHECK

What is the main cost of a moving-average crossover system?

Select the best answer

Go deeper

Educational description of a publicly discussed trading approach, illustrated on synthetic data. It is not a recommendation, a signal, or evidence that the approach is profitable. Test any idea yourself, with realistic costs, before risking money.