Backtesting
Published Last updated
Key Takeaway
Backtesting is the process of running a trading strategy's logic against historical price data to produce a statistical performance estimate before committing any real capital to live deployment.
Learn These First
What Is Backtesting?
Backtesting is the process of running a trading strategy's logic against historical price data to produce a statistical performance estimate before committing any real capital to live deployment.
How Backtesting Works
Frequently Asked Questions
What is backtesting and why is it required before live trading a bot?
Backtesting is running a trading bot's strategy logic against historical price data to simulate performance and compute statistical metrics. It is required before live trading because it is the primary pre-deployment evidence that the strategy has genuine edge — defined by the ADL's minimum thresholds of win rate ≥40%, profit factor ≥1.2, maximum drawdown ≤25%, and Sharpe ratio ≥0.5 across at least 100 simulated trades. A strategy that fails these thresholds in backtesting does not meet the evidence standard for live capital commitment under the Algorithm Development Lifecycle.
What is the difference between in-sample and out-of-sample backtesting?
In-sample backtesting tests a strategy against the historical data period used during strategy development and parameter selection. Out-of-sample backtesting tests the identical strategy — with no parameter changes — against a separate historical period not seen during development. The ADL requires walk-forward validation where the dataset is split: months 1–12 are in-sample for development and initial backtesting, months 13–18 are out-of-sample for final validation only. If out-of-sample performance is within 20% of in-sample performance, the strategy likely has genuine edge that generalises beyond the specific data it was designed on.
Why does a strong backtest result not guarantee strong live trading performance?
Three systematic gaps separate backtested from live performance. Slippage: real orders execute at slightly different prices than the signal price because markets move between signal generation and order submission, which backtesting assumes away with perfect fill pricing. Market impact: large orders shift price against the trader during execution, which backtesting ignores. Regime change: markets evolve, and strategies tested on one historical period may face different conditions in a new cycle. These gaps mean strong backtest metrics are necessary but not sufficient evidence for live deployment — paper trading provides the additional real-world validation layer.
Common Misconceptions About Backtesting
A high win rate in backtesting confirms the strategy is profitable and ready for live trading.
A high backtested win rate is neither necessary nor sufficient for live profitability. It is not necessary because a strategy with a 40% win rate at 1:1.5 risk-reward is mathematically profitable. It is not sufficient because high win rates in backtesting are a primary symptom of overfitting — a state where the strategy is tuned so specifically to historical patterns that it captures noise rather than genuine edge. Backtested win rates above 70% should prompt overfitting investigation rather than confidence. Walk-forward validation on out-of-sample data is the primary diagnostic for determining whether high win rates reflect real edge.
Backtesting on more historical data always produces more reliable and accurate results.
More data increases statistical trade count, improving metric confidence — but only if the data represents conditions relevant to current markets. Including a decade of historical data spanning multiple distinct regimes can dilute results: a strategy that performs well in trending markets appears less impressive when its backtest averages in years of sideways price action. The ADL's minimum of twelve months balances statistical significance with market relevance. Walk-forward validation on recent out-of-sample data provides stronger evidence of current edge than extending the backtest window indefinitely into distant historical market conditions.
Backtesting results are accurate because they use real historical price data.
Using real historical price data makes backtesting historically plausible under specific assumptions, not objectively accurate. The most critical assumption is perfect fill pricing: backtesting assumes trades execute exactly at candle close prices, which does not happen in live markets where slippage, spreads, and partial fills cause real execution prices to differ. Additionally, look-ahead bias errors in signal logic — where future data inadvertently influences past decisions — can be present even when using entirely real historical price data, requiring careful code review to detect and eliminate before trusting any performance metric output.