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 differsWhat the backtest doesWhat can happen in real trading
FillsFills at a price taken from the candle, plus a fixed slippageA real fill depends on the orders waiting at the venue at that moment
CostsTakes off the fees and slippage you setReal fees and real slippage can be higher or lower than your settings
The futureUses past prices onlyNew prices can behave differently
FitJudges rules on the stretch you testedRules tuned to that stretch can fail on the next one (overfitting)
YouNever hesitates, never skips a ruleA 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 settingsA harsher real fill
Gain before costs0.60%0.60%
Fees, entry and exit0.10%0.10%
Slippage, entry and exit0.06%0.40%
Left after costs0.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