Common Mistakes in Backtesting and How to Avoid Them
Look-ahead bias, missing costs, overfitting, too few trades, unrealistic fills, data errors and hidden risk in grids and martingales - ten backtesting mistakes and the fix for each.
Most failed trading systems were not unlucky - they were tested in a way that guaranteed a good-looking result. The mistakes below appear again and again, from first-time strategy builders to experienced developers. Each one comes with a symptom you can look for and a concrete fix.
1. Look-ahead bias
What it is. The strategy uses information that was not available at the moment of the decision: the close of the current bar, an indicator that recalculates past values, a daily high used before the day ended.
Symptom. Entries suspiciously close to the best price of the bar, a very high win rate, results that collapse when you delay entries by one bar.
Fix. Make decisions only on closed bars, read indicator values from the previous bar, and test the effect of a one-bar delay. If the result changes dramatically, something is leaking.
2. Ignoring costs
What it is. Testing without realistic spread, commission, swap and slippage.
Symptom. A short-term strategy with a small average trade looks great; adding costs turns it negative.
Fix. Use the broker’s real commission, tick data with historical spreads where possible, and a stress test with costs increased by 50-100%. If the edge disappears, it was never wide enough to trade.
3. Overfitting the parameters
What it is. Tuning parameters and rules until the equity curve looks perfect. The strategy learns the noise of this particular history.
Symptom. Many parameters, one magic combination, sharp drop in performance when any setting moves slightly, poor results on new data.
Fix. Keep the number of parameters small, prefer stable parameter regions over single peaks, and reserve out-of-sample data you never use for tuning.
4. Testing many ideas and keeping the winner
What it is. A quieter cousin of overfitting. You try 50 entry rules, keep the best, and report its backtest as if it were the only one you tested.
Symptom. The chosen idea looks much better than the average of all ideas, but does nothing special out of sample.
Fix. Count how many variants you tried, and raise the bar accordingly. Research on backtest overfitting (Bailey, Borwein, López de Prado and Zhu) shows how quickly the probability of selecting a false winner grows with the number of trials.
5. Too few trades
What it is. Drawing conclusions from a sample of 20-40 trades.
Symptom. Statistics change a lot when one or two trades are removed; the largest winner makes up a big share of total profit.
Fix. Aim for at least about 100 trades; test on longer periods or related instruments; remove the best trade and see what remains.
6. One market regime
What it is. Testing only on a period where the market behaved one way - a long trend, or a quiet range.
Symptom. Excellent results in one year, flat or negative in others.
Fix. Split results by year and by volatility regime. Include crisis periods and quiet periods. A robust strategy does not need to win everywhere, but it should not depend on one environment.
7. Unrealistic fills
What it is. Assuming stops fill exactly at the level, limit orders fill whenever price touches them, and breakouts get the price on the chart.
Symptom. Breakout and news strategies that look smooth in tests and slip badly live.
Fix. Add slippage to stop and market orders, require price to trade through a limit order level rather than touch it, and examine trades near session opens and news releases.
8. Bad data
What it is. Gaps, spikes, wrong time zones or data from a different broker.
Symptom. Isolated huge winners or losers on days when nothing happened; session strategies that behave strangely around daylight-saving changes.
Fix. Inspect and clean data before testing - see how to collect quality historical data.
9. Hidden risk in position management
What it is. Grids, averaging down and martingale sizing produce many small wins and smooth balance curves, while the real risk sits in open positions and rare sequences.
Symptom. High win rate, small balance drawdown, large equity drawdown, rising exposure during losing periods.
Fix. Judge these strategies on equity drawdown and maximum exposure. Stress-test with longer adverse moves than the history contains. Use hard limits on the number of positions and on account drawdown.
10. Changing the rules after looking at the results
What it is. Small edits after each test: an extra filter here, a different exit there, until the result is good.
Symptom. A strategy with many special cases, each explained by a specific historical event.
Fix. Write a test plan before you start: hypothesis, rules, parameter ranges, data split and the metrics that decide success. Keep a log of every version you tested.
A pre-flight checklist
Before you believe any backtest, confirm:
- Decisions use only information available at the time.
- Spread, commission, swap and slippage are realistic.
- At least about 100 trades, results stable across years.
- Out-of-sample data was not used for any decision.
- Nearby parameter values give similar results.
- Data has been checked for gaps, spikes and time zone issues.
- Equity drawdown and exposure are acceptable, not just balance drawdown.
- The number of variants tried is recorded.
Key takeaways
- Most bad backtests are optimistic in predictable ways.
- Look-ahead, missing costs and overfitting cause the largest gaps between test and live results.
- Write the test plan first, and keep untouched data for the final verdict.
- Smooth curves from grid or averaging logic hide risk in open positions.
FAQ
What is the most common backtesting mistake?
Testing many variants and believing the best one. Every extra variant increases the chance that the winner is simply the luckiest. Keep part of the data untouched and judge the final choice only there.
How can I tell if my backtest has look-ahead bias?
Signs include an unusually high win rate, entries at the exact high or low of a bar, and results that collapse when you shift entries by one bar. Make the strategy act only on closed bars and compare.
Are grid and martingale backtests reliable?
They can be technically correct and still misleading, because the risk sits in rare sequences that a single test period may not contain. Judge them by equity drawdown, exposure and stress tests, not by win rate or smoothness.
Sources and further reading
- Bailey, Borwein, López de Prado, Zhu: The Probability of Backtest Overfitting - papers.ssrn.com
- cTrader Help: Backtest a cBot - help.ctrader.com