Strategies · intermediate · 8 min
Trend-Following Basics
Trend following is the oldest systematic idea in markets: buy what is going up, stay with it while it keeps going up, and step aside when it turns. Mechanised with moving averages, it becomes a rule any backtester can run — enter when a faster average crosses above a slower one, exit when it crosses back below. This lesson runs exactly that on real data and reads the verdict.
The rule
A classic medium-term trend follower:
- Entry: the 20-day SMA closes above the 50-day SMA.
- Exit: the 20-day SMA closes back below the 50-day SMA.
Faster than the golden cross's 50/200, so it trades more often and reacts sooner — the trade-off being more false starts. That is the exact strategy baked below, run on SPY over five years of daily bars.
What happened, historically
Over the baked window the rule took 12 trades and returned about +12%. Set that next to the number that actually matters — buying and holding SPY returned about +73% over the same period. The "trend follower", trying to catch the up-moves and dodge the down-moves, captured a small fraction of a market that mostly went up, while taking a 28% drawdown along the way. Being clever cost money versus doing nothing.
The honest verdict
Random control
Beat 31.6% of 500 randomly-timed versions of itself (real 12.41% vs random average 25.67%).
Out-of-sample
Too few trades to compare (9 in-sample, 3 out).
Significance
t = 0.546 against a 3.5 threshold.
Deflated Sharpe
0.7056 — Sharpe of 0.1577.
These checks describe how much of this backtest survives statistical scrutiny. Past simulated performance is not a guide to future results, and nothing here is a recommendation to trade.
This one doesn't just underperform buy-and-hold — it fails the robustness gates outright, and the random control shows why. A version of the same strategy with its entry timing scrambled averaged about +26% — more than the real strategy's +12%. The real result landed below the middle of its own random distribution: roughly two-thirds of randomly-timed versions did better. The signal's timing wasn't just failing to add value; on this window it was actively worse than random. The significance test (t = 0.5, far below the 3.5 bar) and the deflated Sharpe agree: there is no measurable edge here.
What to take from it
This is the lesson the whole track is built around, in one example. A strategy that sounds sensible — "ride the trend, cut the losers" — and even makes a positive return can be, on inspection, worse than a coin flip and far worse than sitting still. The positive return was the market's, not the strategy's.
None of this says trend following can never work, on other instruments, timeframes, or rules — and none of it is a suggestion about what you should trade. It says that this rule, on this data, does not survive honest testing, and that you can only know that by testing it honestly. The headline "+12%" tells you nothing; the random control tells you everything.
Try it yourself
Load this configuration into the Strategy Editor, run it, and open the Robustness tab.
What to read next
- The Overfitting Trap — why a tuned version would look even better and be even more misleading.
- The Golden Cross — the slower cousin, same test.