Is backtesting accurate? What it can and cannot tell you
By Oalgo · Last reviewed
A backtest can be accurate about the past and still say little about the future. It follows your rules on the prices and costs it was given. It cannot know what prices will do next.
What is a backtest accurate about?
#- It applies your rules exactly as written to every candle in the date range you pick.
- It steps through past prices one candle at a time, in order.
- It takes off the fees and the slippage you set.
Where can a backtest differ from real trading?
#| What differs | What the backtest does | What can happen in real trading |
|---|---|---|
| Fills | Fills at a price taken from the candle, plus a fixed slippage | A real fill depends on the orders waiting at the venue at that moment |
| Costs | Takes off the fees and slippage you set | Real fees and real slippage can be higher or lower than your settings |
| The future | Uses past prices only | New prices can behave differently |
| Fit | Judges rules on the stretch you tested | Rules tuned to that stretch can fail on the next one (overfitting) |
| You | Never hesitates, never skips a rule | A person may skip, change or stop rules under stress |
What does a worked example of costs look like?
#One made-up trade gains 0.60% before costs. Costs are made-up too: a fee of 0.05% on entry and on exit, and slippage of 0.03% on each side. A harsher real fill has slippage of 0.20% on each side.
| Backtest settings | A harsher real fill | |
|---|---|---|
| Gain before costs | 0.60% | 0.60% |
| Fees, entry and exit | 0.10% | 0.10% |
| Slippage, entry and exit | 0.06% | 0.40% |
| Left after costs | 0.44% | 0.10% |
The same trade keeps 0.44% in one case and 0.10% in the other. Rules that trade often meet this difference on every trade, so the costs you set matter more for them.
How can you trust a backtest more?
#- Run it on more than one date range, and read the number of trades in each (see how many trades you need).
- Raise the slippage and see whether the report still holds up. In Oalgo the test settings have a Slippage + funding % field and a Fee % field.
- Check that no rule uses information it could not have had at the time (lookahead bias).
- Run a forward test on new prices.
Read next
- How many trades do you need in a backtest?There is no single number. See how much one trade weighs, how far a win rate can move by chance at 10, 30, 100 and 300 trades, and what else to check.
- How to read backtest results: a step-by-step guideHow to read backtest results step by step: trades and dates first, then drawdown and fees, and the end result last. Plain definitions of each number.