Backtesting is the process of testing a trading strategy against historical market data to evaluate how it would have performed in the past. It applies the strategy's rules (entries, exits, position sizing) to past price data to generate performance statistics such as profit factor, win rate, maximum drawdown, and total return.
Backtesting involves defining strict entry and exit rules, then running them against a historical dataset. The software simulates each trade as if it happened in real time, tracking entries, exits, stop losses, and take profits. The output includes key metrics: total net profit, profit factor, maximum drawdown, win rate, average win/loss, Sharpe ratio, and more. Backtesting can be done manually (reviewing charts and marking hypothetical trades) or automatically (using platforms like NinjaTrader, MetaTrader, or Python scripts). The quality of the backtest depends on data quality, sample size, and accounting for slippage and commissions.
A trader develops a moving average crossover strategy: buy when the 20-period EMA crosses above the 50-period EMA, sell when it crosses below, with a 2% risk per trade. They backtest this strategy on 5 years of EUR/USD data (approximately 1,300 trading days). The backtest shows: 420 trades, 45% win rate, 1:2.5 R:R, profit factor of 1.65, maximum drawdown of 18%, and total net return of 85%. The trader now has data to evaluate whether this strategy is worth trading live.
Backtesting is essential for strategy validation. Without it, traders are essentially gambling based on untested assumptions. It reveals whether a strategy has a statistical edge and helps identify weaknesses before risking real money. However, backtesting has limitations: past performance does not guarantee future results, curve-fitting is a real danger, and market conditions change. The best approach is to combine backtesting with forward testing (paper trading) and Monte Carlo simulation.