Backtesting
Backtesting is the practice of running a trading strategy's exact rules against historical market data to see how that strategy would have performed if it had been traded in the past. A trader first writes the strategy as a precise, mechanical set of conditions — for example, "buy EUR/USD when the 50-day moving average crosses above the 200-day moving average, and close the position when it crosses back below" — and then applies those conditions to years of historical price bars, one by one, as if trading them in real time. The output is a simulated track record: number of trades, win rate, average profit and loss per trade, largest losing streak, and overall return.
The practical value is obvious once you consider the alternative: trading an untested idea live and finding out the hard way that it loses money in choppy markets or during specific news events. A solid backtest does not guarantee future results, but it filters out strategies that are clearly broken and gives a realistic sense of a strategy's typical drawdown, so a trader can size positions appropriately and avoid being surprised by a losing streak that is actually normal for that system. For example, backtesting a simple moving-average crossover system on EUR/USD over a five-year window might show 340 trades, a 42% win rate, and a maximum drawdown of 18% of account equity — numbers that tell a trader whether the strategy's risk profile matches their tolerance long before any real capital is at stake.
Backtesting applies across every market a trader might touch — forex, stocks, crypto, and commodities like gold or oil — but the reliability of the results depends heavily on data quality and market history. Major forex pairs and large-cap stocks often have decades of clean price history, while many crypto assets only have a few years of data, some of it from exchanges that no longer exist or that had unusually thin liquidity, which can make a crypto backtest look better or worse than live trading would actually be. Traders should also watch for "overfitting" — tuning a strategy's parameters so precisely to past data that it looks perfect in the backtest but falls apart on new, unseen data — and for costs like spread, commission, and slippage, which are easy to leave out of a backtest but which erode real returns.
Overfitting is the failure mode most people have heard of, but two quieter biases distort more backtests than parameter-tuning does, and both come from the data rather than the strategy. Survivorship bias is the first: a universe of stocks assembled today contains only the companies that still exist, so a strategy tested on it has been spared every delisting, bankruptcy and takeover-at-a-discount that a trader living through the period would have suffered. The effect is large enough to turn a losing strategy into a winning one on paper, and it is worst precisely where it matters most — in small caps and in crypto, where the failure rate of the underlying assets is highest.
Look-ahead bias is the second and is easier to introduce by accident. It means using information in a simulated decision that would not have been available at the moment of that decision: trading on a company's earnings using the figures as restated later, computing an indicator from a bar's close and then entering at that same bar's open, or using an index membership list as it stands now for a period when the membership was different. Each of these produces results that are not merely optimistic but impossible, and none of them shows up as an obvious error — the equity curve simply looks good.
The structural defence against all three is holding data back. Develop and tune on one portion of the history, then run the finished rules once on a portion the search never touched, and treat that single out-of-sample result as the real one. The discipline is that it has to be once: testing on the held-out data, adjusting, and testing again converts it into in-sample data and destroys the protection. Walk-forward testing formalises the idea by rolling the split repeatedly through the history. None of it makes a backtest predictive — it makes it honest, which is a lower bar and still one most backtests fail.