What Is Backtesting in Trading?
Backtesting is the practice of running a trading strategy's rules over historical market data to see how those rules would have performed — every entry, every exit, every win and loss, replayed candle by candle. It is the closest thing trading has to a laboratory: before you risk a single dollar, you find out whether the idea in your head ever actually worked in the market you plan to trade.
How a backtest works
A backtest engine walks forward through historical candles one at a time. At each candle it asks: do the strategy's entry rules fire here? If a position is open, do the exit rules — stop loss, take profit, trailing stop, time limit — close it? The engine records each simulated trade and then summarizes the results: net profit, win rate and expectancy, profit factor, and maximum drawdown.
The critical rule of an honest backtest is simple to state and easy to violate: at every candle, the engine may only use information that existed at that candle. A backtest that peeks even one bar into the future — using a swing low that had not yet formed, an indicator value that would later repaint, a daily close before the day ended — produces beautiful, fictional results.
What backtesting can tell you
- Whether the edge ever existed. If a strategy loses money over ten years of history, there is no reason to believe it will make money next month.
- What the losing stretches look like. Every strategy has drawdowns. Seeing that a system historically lost 14 trades in a row tells you what you must be prepared to sit through.
- Whether the edge survives costs. Many strategies are profitable at zero spread and dead after realistic transaction costs. A backtest that ignores spread and commission is measuring a market that does not exist.
What backtesting cannot tell you
A backtest is evidence, not prophecy. Markets change; an edge measured over the past can fade. Backtests also cannot capture everything about live execution — real spreads vary by hour, fills slip in fast markets, and brokers differ. This is why serious workflows do not stop at the backtest: they verify the same strategy on a second independent engine, then run it on a demo account, and compare all three. If your backtest says 65%, your chart-platform tester says 51%, and your demo says 50%, the difference is not bad luck — it is information about where your simulation diverges from reality. (That three-stage comparison is exactly what ForexEdge's Strategy Journey page shows side by side.)
The classic backtesting traps
- Look-ahead bias — using future information, usually by accident. The most common source is indicators or pivots that are only "confirmed" several bars later.
- Overfitting — tuning parameters until the history looks perfect. A strategy with eleven finely-tuned parameters has usually memorized the past, not learned the market.
- Survivorship in the data — testing only on the pairs and periods where the idea looks good and quietly forgetting the rest.
- Ignoring costs — spread, commission, and financing turn many paper edges negative.
Related reading: why TradingView tester results differ from live fills, and how to backtest a forex strategy free, without writing code.
ForexEdge backtests forex strategies without code, verifies them trade-for-trade against TradingView, and tracks live results against the tested expectation.
Try ForexEdge free