Backtesting
Definition
Testing a trading strategy using historical data to see how it would have performed in the past.
In Detail
Backtesting is the process of applying a trading strategy to historical market data to evaluate how it would have performed in the past. It is the primary method for validating whether a strategy has a genuine statistical edge before risking real capital. A rigorous backtest defines exact entry and exit rules (with no subjective interpretation), applies those rules to every qualifying signal in the historical data, accounts for realistic trading costs (commissions, slippage, and spread), and produces a comprehensive set of performance metrics including total return, maximum drawdown, Sharpe ratio, win rate, average win/loss size, and profit factor. The fundamental assumption of backtesting is that patterns in historical data provide some predictive value for the future — while this assumption has limitations, systematic backtesting remains the most practical and widely used method for strategy evaluation in quantitative and discretionary trading alike. The two greatest dangers in backtesting are overfitting (creating a strategy so perfectly tuned to past data that it fails on new data) and look-ahead bias (accidentally using information that would not have been available at the time of each historical trade). Professional quants mitigate these risks through out-of-sample testing, walk-forward analysis, and Monte Carlo simulation.
How to Use in Trading
Start by defining your strategy rules with complete precision — every entry signal, exit signal, stop loss, position sizing rule, and trade management technique must be explicit enough that a computer could execute them without human judgement. Run the backtest over a sufficiently long period (at least 5-10 years of data that includes both bull and bear markets). Evaluate the results holistically: a strategy with 200% total return but 60% maximum drawdown is likely untradeable because you will almost certainly abandon it during the drawdown. A more modest 50% return with only 15% maximum drawdown is far more likely to survive real trading. Split your data into in-sample (used to develop the strategy) and out-of-sample (never seen during development) — if the strategy performs well on both, it is less likely to be overfit. Include realistic transaction costs in every backtest; many strategies that look profitable in theory are eroded to break-even or loss after accounting for the real costs of execution. Finally, ensure a meaningful sample size: a strategy based on 20 trades is statistically unreliable, while 200+ trades provide much greater confidence.
Example
You develop a mean-reversion strategy: buy when a stock's 14-day RSI drops below 25 and the stock is above its 200-day moving average (oversold in an uptrend); sell when RSI recovers above 50 or after 10 trading days, whichever comes first; stop loss at 5% below entry. You backtest this on 50 liquid stocks over 8 years of data. Results: 847 trades, 62% win rate, average winner +3.8%, average loser -2.9%, maximum drawdown 18%, annualised return 14.2%, Sharpe ratio 1.35, profit factor 1.68. You then run the same strategy on 2 years of out-of-sample data: 198 trades, 59% win rate, average winner +3.5%, average loser -3.1%, Sharpe ratio 1.12. The out-of-sample performance is slightly weaker but structurally consistent, suggesting the strategy has a genuine edge rather than being overfit to the training data. You proceed to paper trading with confidence.
Backtesting Strategies
Go beyond the definition with our in-depth guide
Related Terms
More Strategy Terms
Arbitrage
Simultaneously buying and selling an asset in different markets to profit from price differences, considered risk-free profit.
Confluence
When multiple technical indicators or analysis methods point to the same trading signal, increasing its reliability.
Day Trading
Opening and closing positions within the same trading day, not holding overnight.
Dollar Cost Averaging (DCA)
Investing a fixed amount regularly regardless of price, reducing the impact of volatility and avoiding market timing.
High-Frequency Trading (HFT)
Algorithmic trading that executes a large number of orders at extremely high speeds.
Put This Knowledge to Use
Practice trading with $100,000 virtual capital. No risk, real market conditions.
Start Paper Trading Free