Backtesting
Backtesting is a test of a trading strategy on historical prices. It can be manual or automated. A past net result is not a forecast, and it is not a signal.
On this page
Backtesting is a test of a trading strategy on historical prices, to see how the rules would have behaved in that past sample. It is not a signal, and not a forecast. A past result does not guarantee a live result, and the test does not remove the chance of a loss.
Manual and Automated Tests
A backtest can be done by hand, by stepping through past bars and recording each decision, or by a program that applies the same rules to a historical series and produces a report. Bar replay is a related manual-testing tool: it plays past bars in sequence so decisions can be practised on prices that have already occurred. Both methods still depend on the rules, the data, and the costs that were included. There is no single required method, and no universal performance figure.
What a Backtest Can Show — and What Can Go Wrong
A test report often shows the net result, the drawdown from a peak, and the number of trades in the sample. Those figures describe that sample only. If the rules were fitted too closely to the same past prices — overfitting, also called curve fitting — the report can look strong and then fail on new data. Lookahead bias can also distort a test, if a decision uses information that would not have been available at the time. If spreads, commissions, or slippage are left out, the net result is incomplete. A short sample is another risk: a handful of trades is not a stable measure.
A Simple Example
Suppose an illustrative 10-trade sample, called Sample B and not a live record, has 2 wins of 500.00 and 8 losses of 100.00. The gross result is (2 × 500.00) − (8 × 100.00), or 1,000.00 − 800.00, which is +200.00. If an assumed cost of 10.00 is applied to each of the 10 trades, the total cost is 10 × 10.00, or 100.00, and the net result is 200.00 − 100.00, or +100.00. Those figures are an illustration, not a recommended rule and not a reason to buy or sell. A different cost, a missed slip, or a smaller sample can change the sign of the result. A past +100.00 does not forecast the next 10 trades.
Practical Point
A common mistake is to treat a tidy backtest as a forecast, or to keep adjusting the rules until the past sample looks perfect. Another is to leave costs out, or to rely on a handful of trades. Use a backtest as a review of one historical sample, and treat it as a test, not as a signal.