Skip to main content
All posts
Backtesting & Validation

How Backtesting Works, And What It Can't Tell You

Backtesting replays a strategy against historical data. What the process does, why results look better than they were, and how to read a report honestly.

By Stretus Research3 min read

What is backtesting?

Backtesting is the process of running a trading strategy against historical market data to see how it would have performed. The engine steps through past candles in order, evaluates your rules at each one, and records the trades those rules would have produced.

The value is not the return figure at the end. It is that the exercise forces every rule to be specified exactly. You cannot backtest "buy when momentum looks strong", and it surfaces behaviour you did not intend, usually within the first run.

How does the engine avoid seeing the future?

It processes data strictly in order and only lets a rule reference information that existed at that moment. Any rule that touches a later candle produces results that cannot be reproduced live, the flaw known as lookahead bias.

This sounds obvious and is a surprisingly common defect. Using a day's closing price to decide an entry earlier in that day is the classic case: the backtest shows an impossible edge, and live trading finds none of it.

What a report should tell you

  • Total return, and the period it covers
  • Maximum drawdown, the worst peak-to-trough fall, which is what you would have had to sit through
  • Sharpe ratio, return relative to volatility
  • Win rate, and average win against average loss (a low win rate can be fine if wins are large)
  • Number of trades, a strategy with nine trades has told you almost nothing
  • Costs applied, itemised

Why do backtest results look better than they were?

Three reasons, in order of impact: costs left out or understated, a strategy tuned until it fit the test data, and a window too short or too favourable to be representative.

Costs are the big one. Brokerage, slippage and statutory charges are small per trade and ruinous once they add up for anything that trades often. A backtest reporting gross price differences is not describing a business.

Overfitting is the subtler one. Adjust parameters until the equity curve looks good and you have described the past rather than discovered a rule. The giveaway is fragility: change a threshold slightly and performance collapses.

What a backtest can and cannot establish

QuestionCan a backtest answer it?
Did these rules have an edge in this window?Yes, if costs are modelled
Are the rules internally consistent and complete?Yes. It will not run otherwise
What drawdown would I have endured?Yes, and read this before the return figure
Will the edge persist?No
How will it fill in a thin market?No, only live or paper execution shows that
Have I overfitted?Only indirectly, by testing out of sample

What comes after a good backtest?

Paper trading. It runs the same rules against live prices with no capital at risk, which tests the things a backtest structurally cannot: real fills, real latency, and whether you actually leave the strategy alone.

That last point is not a joke. The most common reason a validated strategy fails live is the operator intervening during its first drawdown. Paper trading reveals that tendency at no cost.

Frequently asked questions

How much history should I backtest over?

Enough to include conditions different from today's. A window containing only a trending market tells you how the strategy behaves in a trend and nothing else. Several years, spanning at least one clear regime change, is a reasonable floor.

What is a good Sharpe ratio?

Context-dependent, and easy to game with a short window or a handful of trades. Read it alongside maximum drawdown and trade count rather than on its own.

Does a profitable backtest mean the strategy will work?

No. It means the rules had an edge in the period tested, assuming costs were modelled correctly. Persistence is a separate question that no backtest can answer.

What is out-of-sample testing?

Holding back part of your data, developing the strategy on the rest, then testing once on the held-back portion. If performance falls apart there, you fitted the strategy to the development window.