What it is
A backtest applies a strategy's rules to past data, day by day or month by month, as if you had followed them in real time. It shows how the rules would have performed, including returns, drawdowns and trades.
How one is built
- Define the rules exactly.
- Choose the period and the universe of investments.
- For each date, use only data that was available on that date.
- Record trades, including costs.
- Measure results: CAGR (compound annual growth rate), Maximum drawdown, Sharpe ratio and others.
Common biases
| Bias | What goes wrong |
|---|---|
| Look-ahead | Using data not yet known on that date, such as earnings before they were reported |
| Survivorship | Testing only companies that still exist, missing those that failed |
| Overfitting | Rules tuned to past noise. See Overfitting in investing |
| Cost | Ignoring spreads, slippage and taxes. See Portfolio turnover |
| Period | A window that happened to suit the strategy |
Using backtests wisely
A backtest is a way to reject bad ideas, not to prove good ones. If a rule fails in a backtest, it probably fails in reality. If it succeeds, it has only passed the first test. Next: Out-of-sample testing and How to read a backtest.
Try it Backtest a Strategy
See also
- Overfitting in investing What overfitting is, why strategies tuned to past data fail in live trading, what a large study of community strategies found, and how to measure it.
- Out-of-sample testing How out-of-sample and walk-forward testing check a strategy on data it was not built on, how to split your data, and how to read the results honestly.
- How to read a backtest Which numbers in a backtest report to trust, which to question, a checklist for spotting unrealistic results, and how to compare a strategy with a benchmark.
- Systematic investing What systematic, rules-based investing is, how it removes emotion from decisions, its advantages and pitfalls, and how to build a simple rule-based strategy.
Last updated September 30, 2026. Education only, not investment advice.