Backtesting
Family V · Platforms
Not to be confused with forward testing, demo account, trading simulator.
Backtesting is the reconstruction of a trading strategy's past behaviour by feeding its entry, exit and sizing rules through a historical price series. It produces a simulated trade list and derived statistics such as net profit, drawdown and win rate. The exercise is a feasibility check on a rule set, not evidence that the rule set will work in future conditions.
How a backtest is constructed
A backtest requires three inputs: a rule set precise enough to be executed mechanically, a price history covering the instruments and period tested, and assumptions about execution. The engine walks the data bar by bar or tick by tick, evaluates the rules at each step, and records fills.
Execution assumptions determine how realistic the output is. Common choices include:
- Fill price — next bar's open, the signal bar's close, or a limit price that may never trade.
- Slippage — a fixed amount, a spread-based estimate, or a model tied to order size.
- Commission — per-share, per-contract or per-trade, which varies by broker and instrument.
- Data quality — adjusted versus unadjusted prices, survivorship bias in index constituents, and gaps in the series.
Results are only comparable when these assumptions are stated alongside them.
Worked example
A simple moving-average crossover is tested on one instrument over 250 trading days, with a commission of 0.05% per side and slippage of one tick per fill.
Removing the cost line turns a marginal result into an apparently profitable one, which is why costs are reported separately.
Limitations
A backtest is a historical simulation, and its output is conditional on the data and assumptions used. Known failure modes include overfitting, where rules are tuned until they fit past noise; look-ahead bias, where a decision uses information not yet available at that bar; and survivorship bias, where only currently listed instruments are tested. Transaction costs, borrow availability and margin rules vary by broker and jurisdiction, so a backtest that omits them overstates returns. Out-of-sample testing and forward testing on live or paper data are used to check whether a result survives conditions the rules were not fitted to.
Often confused with
- forward testing
- Forward testing is the practice of running a trading strategy on live market data in real time, usually on a demo account, to evaluate its performance before committing real capital.
- demo account
- A demo account is a simulated trading account that uses virtual funds to replicate live market conditions, allowing users to practise order placement and platform features without risking real money.
- trading simulator
- A trading simulator is software that reproduces market data and order execution in a risk-free environment, allowing users to place hypothetical trades and track a virtual account balance without committing real capital.