A backtest replays your rules on past candles and reports what would have happened. This lesson explains which questions that answers well, which it cannot answer, and how to read a result as a measurement with some uncertainty rather than as a forecast.
A measurement of the past
A backtest applies fixed rules to historical data and records the trades those rules would have produced. The output is a list of results, usually expressed in R, from which you compute a win rate, an expectancy and a drawdown. Every one of those numbers describes the sample you tested, and nothing more.
This is still useful. A backtest can show that a rule set is coherent, that it trades as often as you expected, that its losses are of the size you planned for, and that it behaves very differently in trending and ranging periods. It can also reject ideas cheaply: if a rule loses money across a large sample, you have learned that without risking anything.
What it cannot tell you
A backtest cannot tell you that the future will resemble the past. Markets change character, spreads widen, and an edge that existed in one period may fade. It also cannot tell you how you will behave during a long losing streak, or how your broker will fill orders in fast markets.
- It can answer: did these exact rules, with these assumptions, make or lose money on this data?
- It can partly answer: how large were the drawdowns and how long did they last?
- It cannot answer: will the rules make money from now on?
- It cannot answer: are the assumptions about fills and costs realistic? That has to be checked separately.
Reading a result with its uncertainty
Every metric from a finite sample has a margin of error. The next lessons show how to estimate it; the example below previews the idea with one result.
Worked example
A result and its rough error range
- A backtest produces 250 closed trades with an average result of +0.15R per trade (the expectancy).
- The standard deviation of the individual trade results is 1.4R.
- The standard error of the expectancy is about 1.4 / √250 = 1.4 / 15.81 = 0.089R.
- An approximate 95% range is ±1.96 × 0.089 = ±0.173R, so about 0.15 − 0.173 = −0.02R to 0.15 + 0.173 = +0.32R.
The range includes zero, so even 250 trades do not rule out that the real expectancy is nil or slightly negative.
Assumptions hidden in every test
Behind every backtest sits a list of assumptions: that orders fill at the price shown, that the spread was constant, that the data has no gaps and that trades never affect the market. Each assumption is usually a little kinder than reality, and the errors tend to push in the same direction, towards better-looking results.
A sensible habit is to write the assumptions down next to the result and ask which of them you could check. Costs are the easiest to test: rerun the same trades with a higher spread and see how much of the expectancy survives. If a small change in assumptions removes the edge, the edge was thin to begin with.
In QuantRaider the Backtest tab complements the numbers with a trade-by-trade replay. Stepping through the trades on the chart lets you check that entries, stops and targets sit where your rules say they should, which catches wiring mistakes that no summary statistic would reveal.
Key takeaways
- A backtest measures what fixed rules would have done on past data under stated assumptions.
- It cannot promise future results, and its numbers carry a margin of error that depends on the sample size.
- Use it to reject weak ideas and to understand drawdowns, then confirm on unseen data and a demo account.
- Replay the trades one by one to confirm the rules do what you intended.