Backtesting — Trading Wiki

Testing a strategy against historical data to evaluate its hypothetical performance. Essential for validation but subject to curve-fitting and survivorship bias.

What Backtesting means

Testing a strategy against historical data to evaluate its hypothetical performance. Essential for validation but subject to curve-fitting and survivorship bias.

In depth

Backtesting is the process of evaluating a trading strategy by applying its rules to historical market data to determine how it would have performed in the past. This retrospective analysis generates simulated trade results — including win rate, average return, maximum drawdown, Sharpe ratio, and total profitability — that help traders assess whether a strategy has a quantifiable edge worth deploying with real capital. The backtesting process involves defining strict entry and exit rules, applying them systematically to historical price data (often spanning 5-20 years), and analyzing the resulting simulated performance statistics.

Professional-grade backtesting accounts for transaction costs (commissions, spreads, slippage), position sizing rules, and capital constraints. Tools range from simple spreadsheet-based analysis to sophisticated platforms like QuantConnect, Backtrader (Python), TradingView's Pine Script, and institutional platforms like Bloomberg's backtesting engine. However, backtesting has significant limitations that traders must understand. Curve fitting (or over-optimization) is the most dangerous pitfall — adjusting strategy parameters until they perfectly fit historical data, producing impressive backtest results that don't translate to live performance because they've been tailored to the specific noise patterns of the past rather than capturing genuine market phenomena.

Look-ahead bias (using future information unavailable at the time of the simulated trade), survivorship bias (testing only on stocks that still exist, ignoring those that went bankrupt), and selection bias (only backtesting strategies that visually appear to work on a chart) further compromise results.

Key points

  • Simulates strategy performance using historical price data
  • Curve fitting is the biggest pitfall — overfit strategies fail live
  • Out-of-sample testing validates that the edge is genuine

Practical tip

Split your historical data into two halves: optimize your strategy on the first half (in-sample), then test it unchanged on the second half (out-of-sample). If performance degrades significantly on out-of-sample data, your strategy is curve-fitted to history and won't work live. Only deploy strategies that maintain their edge on unseen data.

Why it matters when you are learning

Backtesting gives you confidence that your strategy has worked in the past. But remember — the map is not the territory. Always forward-test (paper trade) before going live.

Practising Backtesting on the simulator

Reading about Backtesting and using it are different skills. Try it once in the simulator on an instrument you already follow, write down beforehand what you expect to happen, and check the journal a day later to see whether it played out that way. Educational simulation only — not financial advice.

Educational simulation only — not financial advice. TradeHQ is a free educational paper-trading simulator. No real money is traded and no content here is a recommendation.