CustomTradingPlatform .com
Log in Get started free
Home / Backtesting

Backtesting

How to Backtest a Trading Strategy

Direct answer

Write the entry and exit as exact rules, run them over historical data with realistic costs, and report the result alongside the sample size and what could bias it. A backtest is only as trustworthy as its stated limitations.

The five steps

1 · Define

State entry, exit, stop and position size as conditions a machine could check, not as a feeling.

2 · Run

Apply the rule across historical bars with spread, commission and slippage included, not ignored.

3 · Measure

Report win rate, expectancy, drawdown and sample size together. One number alone misleads.

4 · Stress

Test out of sample and across regimes. A rule fit to one period is not yet a strategy.

5 · Disclose

Publish the limitations with the result, especially when the result is negative.

What makes a backtest lie

Look-ahead bias

Using information that would not have been available at the time of the trade.

Survivorship bias

Testing only on instruments that still exist today, which excludes every failure.

Overfitting

Tuning a rule's parameters until it fits the past perfectly and the future not at all.

Ignored costs

Spread, commission and slippage that would have erased the edge in live trading.

Small samples

A result from a few dozen trades is closer to noise than to evidence.

Multiple testing

Trying many rules and reporting only the one that happened to work.

This is the same discipline behind the candlestick study: 89 formations were tested with a stated trend filter, a fixed forward window and a published sample size, and the result is reported as +0.02pp, not as a discovery. Read that study →

See the method applied to a real strategy.