A backtest asks one question: if I had followed these exact rules in the past, what would have happened? Done honestly, it kills bad ideas cheaply and builds earned confidence in good ones. Done naively, it manufactures beautiful equity curves that exist only in hindsight — and most first backtests are the naive kind.
The manual method (start here)
Before any code or software: scroll a chart back two years, cover the right side, and step forward bar by bar, executing your written rules as if live — logging every trade the rules produce (not the ones you like) with entry, stop, exit and R result. Two hundred bars of this teaches more than most tools, because the covering of the right edge is the whole discipline: patterns are obvious in the middle of the chart and ambiguous at the edge, and live trading is conducted entirely at the edge. If your rules feel impossible to apply without seeing what comes next, that is the test failing — the rules are not objective yet.
The biases that inflate results
- Hindsight leakage: "I obviously wouldn't have taken THAT one." Yes you would — the rules said so. Every discretionary exclusion applied backwards is future knowledge smuggled in.
- Look-ahead bugs: using a bar's close to enter at that bar's open, or an indicator value that repaints. Any rule must be checkable at the moment of entry with only completed bars.
- Ignored costs: spread, swap on held positions, and slippage on stops (fills are worse than levels in fast markets). A 0.2R-per-trade edge is routinely a cost artifact. Charge every simulated trade honestly.
- Cherry-picked windows: a trend system tested only on a trending year is a weather report, not a forecast. Include the regime that hates your idea — test the range-bound stretch, the volatility spike, the dead summer.
- Overfitting: covered in the systems lesson, and the backtest is where it happens — every parameter tweak made WHILE looking at results is a step from testing toward memorizing. Split your data: tune on one period, verify untouched on another. The untouched period's number is the only one you may believe.
Reading the output
From your trade log, compute: expectancy in R per trade (the verdict), win rate and payoff ratio (the personality — can you psychologically trade a 35% win rate, however positive its math?), maximum drawdown and longest losing streak (the survival requirements), and trade frequency (an edge that fires twice a quarter cannot pay for itself at retail size). Sample size disciplines all of it: thirty trades is an anecdote, a hundred is a hint, several hundred across regimes begins to be evidence. And treat the backtest's worst drawdown as a floor, not a ceiling — the future always finds a deeper one, because history is a single sample path.
What a backtest cannot tell you
It cannot feel fear — the live version of you, with money attached, executes worse than the replay version, which is why forward-testing small comes next and always. It cannot promise the pattern persists: markets adapt, and edges built on micro-structure quirks decay fastest. And it cannot rescue an idea with no reason to exist — a backtest validates a hypothesis; it is not a hypothesis generator, and rulesets discovered by mining history for whatever worked are precisely the ones that stop working at the right edge of the chart.
The honest pipeline
Idea (a sentence about who loses to you) → written rules → manual replay across mixed regimes → cost-charged statistics on a real sample → out-of-sample check → forward test at 0.1–0.25% risk for 30–50 trades → size up only if live execution matches the tested rules. Every stage exists to make the failure cheaper than the next stage would have been. A backtest's job is not to prove you are right — it is to let history call you wrong before the market charges for the same lesson.