Moving-average crossover
A trend-following strategy: hold a stock while its short average is above its long one, and step aside when it falls below.
4 min readLesson 52 of 57Interactive
In short
It aims to ride long uptrends and dodge long downtrends. The price is lag and whipsaws: it always buys after a rise has started and sells after a fall has begun, and choppy markets trigger false signals.
Why it matters
Buy and hold sits through every crash. A moving-average crossover tries not to. It's one of the oldest and simplest trend-following rules: stay invested while the price trend is up, step into cash while it's down, and let a mechanical rule decide instead of your nerves.
It's worth learning because it shows the basic trade-off of every timing strategy. Getting out of a long fall is valuable, but the rule can only react to moves that have already happened, so it gives back a slice of every trend and gets fooled when the market just churns.
How it works
Take two simple moving averages of the closing price: a fast one over a short window, such as 50 days, and a slow one over a long window, such as 200. When the fast average climbs above the slow one, recent prices are running above the longer-term level, a sign of an uptrend, so you buy. When it drops back below, you sell and hold cash.
Because averages lag, the signals come late by design. A 200-day average barely moves for weeks after a turn. That lag filters out small wiggles, but it also means you buy well above the bottom and sell well below the top.
In MarketLab's backtester the rule runs per stock. Each stock is held at its weight while its fast average is above its slow one, and its share sits in cash otherwise. It trades only on a crossover, and it starts once there are enough days of prices to compute the slow average, so it holds cash at first.
Hold if fast SMA > slow SMA; otherwise hold cash
Own the stock while its recent average is above its longer-term average, and step aside when it isn't.
A worked example
A stock falls from $100 to a low of $80, then climbs to $140 and slips back. The strategy holds cash during the fall.
- The fast average crosses above the slow one when the price is $110: buy. That's $110 ÷ $80 − 1 = 37.5% above the low.
- The price peaks at $140. The averages are still rising, so the strategy holds.
- The fast average crosses below when the price is $120: sell. That's $20 ÷ $140 ≈ 14% below the peak.
- Gain on the trade: $120 ÷ $110 − 1 ≈ 9.1%, against a rise of $140 ÷ $80 − 1 = 75% from low to peak.
- Then the price drifts sideways. A new buy signal comes at $122, and a sell follows at $118: a loss of $4 ÷ $122 ≈ 3.3%, a whipsaw.
Result: The rule avoided the fall to $80 and still made 9.1% on the uptrend, but missed most of the move because of lag, then lost 3.3% when a false signal hit a sideways market.
Try it
Averages and crossovers
Over two years the 20-day and 100-day averages crossed 3 times. The fast one is now above the slow one.
Crossovers
3
Labeled on the chart
Signal now
Uptrend: hold
Warm-up
100 days
Before the slow average exists
Generated prices for illustration, not market data.
How to read it
- Long, steady trends
- Its best case. It rides most of a long rise and steps aside for most of a long fall, which can mean a much smaller max drawdown than buy and hold.
- Sideways, choppy market
- Its worst case. The averages keep crossing back and forth, so it buys high and sells low over and over, losing a little each time.
- Sharp V-shaped crash
- It often sells near the bottom and buys back well above it, missing the quick rebound and ending behind buy and hold.
In the real world
- The 50-day and 200-day averages are watched closely by traders and financial news. A fast average crossing above the slow one is widely called a golden cross, and crossing below a death cross, though neither reliably predicts what comes next.
- Trend-following funds, often called managed futures funds, apply rules in this family across many markets at once, such as stocks, bonds, currencies and commodities. They've tended to do best in long trends, including some major crashes, and to struggle for years in markets without clear trends.
- Many studies have found that simple trend rules on a stock index reduced the depth of the worst falls in the past, but often gave up return in strong bull markets, and that results depend heavily on the averages chosen and on trading costs.
Common mistakes
- Expecting it to buy at the bottom and sell at the top. Lag guarantees it buys after a rise has started and sells after a fall has begun.
- Ignoring trading costs and taxes. A choppy year can produce many trades, and each one costs a little.
- Picking the averages that worked best in a backtest. That's a recipe for Overfitting; check that nearby settings also work.
- Forgetting the time in cash. The strategy is often out of the market, so compare it on risk as well as return.
See it in MarketLab
Test yourself
Optional: 4 quick questions on the words, using the idea, and how it plays out in real markets.
Loading your answers…