Methodology

How Backtesting Works (and What It Can and Cannot Tell You)

A plain-English walkthrough of what a backtest actually measures — and the traps that make a great-looking curve misleading.

By QuantiBot.ai ·

A backtest replays a set of rules against historical market data to show how that strategy would have behaved in the past. It is one of the most useful tools in quantitative research — and one of the easiest to misread. This post walks through what a backtest measures, how to read the results, and where the sharp edges are.

What a backtest actually does

At its core, a backtest steps through history one trading day at a time. On each day it applies your rules — for example, "hold the S&P 500, but move to cash when the 50-day moving average falls below the 200-day" — and records the resulting portfolio value. String those daily values together and you get an equity curve: a picture of how the strategy compounded over the test window.

Because the same engine can run a benchmark (often a simple buy-and-hold of an index), you can compare the two curves side by side. That comparison, not the raw return, is usually the interesting part.

The metrics that matter

A single return number hides most of the story. A few measures give a fuller picture:

  • Total and annualized return — how much the strategy compounded, overall and per year.
  • Maximum drawdown — the worst peak-to-trough decline along the way. This is the number that tells you whether you could have stayed invested through the strategy's ugliest stretch.
  • Volatility — how much the returns bounced around.
  • Sharpe ratio — return earned per unit of risk taken. A higher-return strategy that took far more risk is not obviously better.

Where backtests mislead

A clean-looking backtest can still be wrong in ways that matter:

  • Lookahead bias — accidentally using information that would not have been available at the time of the trade.
  • Overfitting — tuning a strategy so tightly to past data that it captures noise, not a durable pattern. The more knobs you turn, the easier this is to do by accident.
  • Survivorship bias — testing only on companies that still exist today ignores the ones that failed, flattering the result.

None of these mean backtesting is useless. They mean a backtest is a historical fact about a rule, not a forecast. It tells you how a strategy behaved on the data it saw — a starting point for research, not a verdict.

See it for yourself

The fastest way to build intuition is to run one. The embedded backtester below replays a preset strategy on real historical data and charts it against a benchmark, with the drawdown and return metrics laid out. Change the ticker or window and watch how the curve — and the risk — change.