How to backtest a trading strategy without fooling yourself
A backtest can make almost any strategy look brilliant. The skill is not in running one, it is in knowing how it lies to you. Here is how to test a strategy so that the result means something.
Start with a written rule set
Before you look at any data, write down the exact entry, stop, target and position size rules. If a rule needs your judgement in the moment, it cannot be tested. A backtest only measures the rules you can write down.
Use enough trades
Thirty trades prove very little. A strategy that wins 60% over 30 trades could easily be a 45% strategy that got lucky. Aim for at least 100 trades, and more if the results are close to break-even.
Include costs
- Spread on every entry and exit.
- Commission or swap if your broker charges them.
- Slippage, especially around news events, where fills can be far from your price.
A strategy with a small edge before costs is often a losing one after them.
Avoid the common biases
- Look-ahead bias: using information that was not available at the time of the trade, such as the close of a candle that had not finished.
- Overfitting: tuning the settings until the past looks perfect. A strategy with ten tuned parameters has probably just memorised noise.
- Survivorship bias: testing only on markets that are still popular today.
- Cherry-picking the period: testing only on a trending year and calling it proven.
Test on data you did not tune on
Split your data. Build the rules on the first part, then run them once on a second part you have not looked at. If the result collapses, the strategy was fitted to the past. This is called an out-of-sample test.
Then forward test small
Run the strategy in real time on a demo account, or with very small size, for a few weeks before real money. Keep a trading journal so you compare real results with the backtest.
Be honest about your own records
We apply the same standard to ourselves. The setups in our journal are tracked, not audited, and 71 expired setups reached their entry but were not tracked to a result, so we leave them out of our win rate. Any number should come with its caveats.
Trading carries a high risk of loss. This article is for education only and is not financial advice. Results shown are from setups tracked in our own journal, they are not audited, and past results do not guarantee future results.