Backtesting a Trading Strategy: A Practical Guide to Not Fooling Yourself
A backtest answers one question: if these exact rules had run in the past, what would have happened? It is the single most useful tool in systematic trading and also the easiest one to lie to yourself with.
The difference between the two outcomes is process. This guide covers the four biases that inflate backtest results and the workflow that keeps them out.
The four backtest biases
- +Overfitting — tuning parameters until the historical equity curve looks perfect. The more combinations you try, the more certain you are to find one that memorized noise. Antidote: fewer parameters, and out-of-sample validation.
- +Look-ahead bias — using information that was not knowable at decision time (closing prices before the close, revised data). Antidote: an engine that only exposes point-in-time data, and suspicion of any result that looks too clean.
- +Survivorship bias — testing only on stocks that still exist today silently removes every delisted loser. Antidote: test on indices/ETFs or survivorship-free universes.
- +Cost blindness — ignoring commissions, spread, and slippage. High-frequency strategies can flip from profitable to losing on costs alone. Antidote: model costs pessimistically from the start.
A workflow that keeps you honest
Treat backtesting as hypothesis testing, not treasure hunting:
- +1. Write the rules down BEFORE testing — signals, filters, exits, sizing. If you cannot state the rule, you cannot test it.
- +2. Test on one instrument and one period first. Resist tuning.
- +3. Validate out-of-sample: hold back the most recent 20–30% of data, or walk the test forward period by period.
- +4. Stress the parameters: if RSI 30 works but RSI 28 and 32 fail, you found noise, not edge. Robust strategies degrade gracefully.
- +5. Only then paper trade. The backtest earns a simulation; the simulation earns real money.
How many trades is enough?
A backtest with 15 trades tells you almost nothing — the confidence interval on a 60% win rate over 15 trades spans roughly 35% to 85%. Aim for 100+ trades across different market regimes before trusting summary statistics, and weight recent regimes more heavily than distant ones. If your strategy trades too rarely to generate that sample, widen the universe of symbols rather than loosening the rules.
Backtesting will not tell you the future. Done honestly, it tells you something almost as valuable: which of your ideas deserve to meet it.