ForexNations Research Desk6 min read
Backtesting means running a trading strategy's rules over historical prices to see how it would have performed. It is the first test any automated strategy should pass. It is also easy to get wrong, in ways that make a weak strategy look strong.
The basic steps
- Write the rules exactly: entry, exit, stop-loss, take-profit and position size, with no room for judgment.
- Get good data: price history long enough to include different market conditions, ideally several years.
- Add real costs: spread, commission and swap. A strategy that only works at zero cost does not work.
- Run the test and record every trade.
- Read the results: net profit, maximum drawdown, number of trades, win rate, average win against average loss.
MetaTrader's Strategy Tester runs this for Expert Advisors; many traders also use Python for more control.
Why backtests mislead
- Over-fitting. Tweak the settings enough and any rules can be made to fit the past perfectly. The more settings you tune, the less the result means.
- Look-ahead bias. The test accidentally uses information that would not have been known at the time, such as the day's close at the day's open.
- Ignoring costs or slippage. Fast markets fill orders at worse prices than the chart shows.
- Too few trades. Twenty trades can look brilliant by chance. Hundreds tell you more.
- One market regime. A test run only on a trending year says little about a choppy one.
How to make a backtest more honest
- Out-of-sample testing: build the rules on one period and test them, untouched, on another.
- Walk-forward testing: repeat that process across rolling windows of time.
- Stress the costs: rerun with wider spreads and see whether the edge survives.
- Forward test: run the strategy on a demo or small live account before trusting it with more.
What to look at beyond profit
| Measure | Why it matters |
|---|---|
| Maximum drawdown | The worst fall you would have had to sit through |
| Profit factor | Gross profit ÷ gross loss; above 1 means profitable before luck |
| Average win ÷ average loss | Together with win rate, shows how the strategy makes money |
| Longest losing streak | Tests whether you could keep following it |
Read more on drawdown and risk-reward ratios.
How we use backtests
Every ForexNations strategy is run against years of historical prices before it goes live, and then watched in live trading. A good backtest is a requirement, not a promise: past results do not guarantee future ones. See our technology for how strategies are built and run.
This article is for educational purposes only and is not investment advice. Trading involves substantial risk of loss. Read our risk disclaimer.
← All insights