reader10 min read

Backtesting: Turning Rules into Evidence

A backtest applies a system's exact rules to historical data to produce the list of trades it would have taken, and the statistics of those trades, so an edge can be measured rather than assumed.

Target audience: Traders with written rules who want to measure an edge before risking money, and avoid the classic backtesting traps.

Learning objectives

  • Produce a trade list and equity curve from explicit rules.
  • Eliminate look-ahead bias by using only past-and-present data at each decision.
  • Avoid survivorship bias by testing the universe as it existed then.
  • Read the core output statistics: expectancy, max drawdown, and trade count.

Definition

A backtest applies a system's exact rules to historical data to produce the list of trades it would have taken, and the statistics of those trades, so an edge can be measured rather than assumed.

Why it matters

Backtesting is how a written system becomes evidence. Done correctly it tells you the expectancy, the drawdowns, and the trade frequency you should expect. Done carelessly it produces a beautiful equity curve that has nothing to do with the future, which is worse than no test at all because it breeds false confidence.

What a clean backtest produces

Feed the rules bar by bar through history and you get a trade list: entry time and price, exit time and price, and the result in R. From that list come the statistics that matter: expectancy per trade, win rate, average win and loss, the equity curve, and the maximum peak-to-trough drawdown. The equity curve is seductive but secondary; the per-trade expectancy and the drawdown are what tell you whether the edge is real and survivable.

Look-ahead bias: the cardinal sin

Look-ahead is using information at a decision point that would not have been available yet. The classic forms: deciding on a bar's close but filling at that bar's open; using the day's high or low before the day is over; or using a indicator value that is only known after the fact. The rule that prevents it is strict: at the moment of any decision, the system may use only data that had already printed. If your test cannot reproduce the exact information set you would have had live, its results are fiction.

Survivorship and other quiet biases

Survivorship bias is testing today's surviving instruments and ignoring those that were delisted, which flatters results because the failures are missing. Test the universe as it existed at each date. Two more quiet biases: using revised data that was not available in real time, and ignoring trades you could not actually have entered (illiquid, halted, or limit-locked markets). A backtest is only as honest as the data and the fills it assumes.

Visual models

Expectancy: win rate and payoff together; a high win rate with a tiny payoff still loses
Expectancy breakeven curveThe curve is the reward-to-risk needed to break even at each win rate. Systems plotted above the curve have positive expectancy; a 65 percent win rate paying only 0.5R sits below the curve and loses, while a 40 percent win rate paying 2R sits above it and wins.0R1R2R3R4R20%30%40%50%60%70%80%90%positive expectancynegative expectancy40% @ 2.0R = +0.2R55% @ 1.0R = +0.1R65% @ 0.5R = -0.03Rreward to riskwin rate
R-multiple sequence: normal losses stay survivable until risk is oversized
R-multiple loss sequenceThe cumulative R curve falls gradually during planned losses, then drops sharply when two pressure trades exceed the one R rule before the reset stabilizes it.+3.0R0.0R-1.0R-3.0R-6.0R+0.8R-1.0R+1.4R-0.9R-1.0R-1.0R-1.8R-2.6R+0.2R+0.9R+1.3R-1R planned risk cappressure trades2 breaks = -4.4Rcumulative Rtrade outcome

Worked examples

Example 1: Why the fill assumption changes everything

A breakout system signals on the close of the 30-bar-high bar. If the backtest fills at that close, it captures a price that, live, you would already have missed. Fill instead at the next bar's open, or at a stop one tick above the level with assumed slippage. On a fast instrument this difference alone can turn a +0.3R expectancy into a negative one. The edge lives or dies in the fill assumption, not the entry rule.

Common mistakes

Deciding on a bar's close but filling at the same bar's open or price (look-ahead).

Testing only instruments that still exist today (survivorship bias).

Assuming perfect fills with no spread, slippage, or commission.

Optimising on the entire history and reporting that same history as the result.

Falling in love with the equity curve while ignoring drawdown and trade count.

Myth vs reality

Myth

That a great backtest guarantees a great future.

Reality

No paired reality note provided.

Myth

That more historical profit means a more robust system.

Reality

No paired reality note provided.

Myth

That the prices in your data are exactly the prices you could have traded.

Reality

No paired reality note provided.

Risk considerations

  • A backtest that ignores costs overstates edge and can mask a system that loses money net.
  • Maximum drawdown in the test is a floor, not a ceiling; live drawdowns are usually deeper.

Practice exercises

1. Audit a backtest for bias

Take any backtest (yours or a published one) and check it against the three bias traps.

  1. Confirm every decision uses only data available at that moment (no look-ahead).
  2. Confirm the tested universe includes instruments that later failed or delisted.
  3. Confirm fills assume realistic spread, slippage, and commission.
  4. Re-read the result with drawdown and trade count, not just total profit.

Quiz

Q1. What is look-ahead bias?

Q2. What is survivorship bias in backtesting?

Q3. Which backtest outputs matter more than the equity curve?

Next lesson

Sample Size and Significance

This lesson is educational content only and is not financial advice. Trading involves substantial risk. A tested process improves decision quality and survivability; it does not predict the market or guarantee any outcome. Trade only with risk you can afford to lose.