A backtest runs a strategy's rules against historical data to see how it would have performed. Done properly, it's the difference between a hunch and evidence — done carelessly, it's a very convincing way to fool yourself.
A backtest takes a strategy's rules — precisely defined, no ambiguity — and simulates applying them to historical data, to see what would have happened. It answers a specific question: "if I had followed this exact rule in the past, what result would it have produced?" That's a narrower claim than "this strategy will work," but it's a necessary first filter before risking any real capital.
The value of a backtest depends entirely on how honestly it's built. Two failure modes dominate: lookahead bias (accidentally using information that wouldn't have been available at the time — like a full year's earnings data applied to a trade made mid-year) and overfitting (tuning the rules so precisely to the historical data that the strategy has essentially memorized the past rather than found a real, repeatable pattern).
A realistic backtest also has to account for costs that are easy to ignore on paper: trading commissions, the bid-ask spread, and slippage (the difference between the price you wanted and the price you actually got, especially in a fast-moving or illiquid market). A strategy that looks great with zero costs can turn unprofitable once realistic frictions are added — which is exactly why this step exists.
A hypothetical strategy trades frequently. Here's how its results change once trading costs and slippage are added — illustrative numbers only.
| Version | Trades / Year | Gross Annual Return | Est. Cost Drag | Net Annual Return |
|---|---|---|---|---|
| No Costs Assumed | 240 | +18.0% | 0.0% | +18.0% |
| Realistic Costs Assumed | 240 | +18.0% | -11.5% | +6.5% |
240 trades a year at even a small per-trade cost (commission + spread + slippage) compounds into a large annual drag — the "no costs" version looks like a great strategy, the realistic version looks merely decent. Always ask which one you're looking at.
Enter a gross backtest return, trade frequency, and a per-trade cost estimate — see how much realistic costs eat into the headline number.
Model: cost drag = trades per year × cost per trade (%). Net return = gross return − cost drag. Illustrative only — actual costs depend on the specific broker, asset, and market conditions.
Answer all five, then hit "Check My Answers" to see how you did. Get one wrong? No problem — the explanation will show you exactly why.
Print-friendly resources to revisit, practice, and dig deeper — no login required.
A backtest tells you how a strategy performed on average across history. The next lesson covers how to recognize when market conditions themselves have shifted, so you know when that average may no longer apply.