Key takeaways
- The same EUR/USD strategy returned anything from +166.5R to −147.8R depending only on how it was tested.
- The biggest lies come from bar size and fills: on hourly bars, guessing that the target hit before the stop turns a losing system into a winner.
- Charge the spread on every trade. On short-term strategies it is often bigger than the edge.
- Always keep data the strategy has never seen. Our London breakout made money until 2020 and lost after.
A backtest is supposed to answer one question: if I had traded these rules in the past, what would have happened? Done carelessly it answers a different one: what is the most flattering story these rules can tell?
To show how much the method matters, we took a single, fixed strategy (the London breakout, on EUR/USD from 2016 to 2026) and tested it five ways. The rules never changed. Only the testing assumptions did.
The first version says this is a strategy that made 166 times its risk. The last says it lost 136 times its risk. Both used the same 2,614 trades. Everything in between is the difference between a backtest that flatters and one that tells the truth.
1. Start with data you can trust
Every backtest inherits the flaws of its data. Free price feeds are convenient and often wrong in ways that are invisible on a chart.
When we checked a widely used free feed against Dukascopy’s bank-grade prices, we found daily candles whose close simply repeated the open, highs and lows cut short, and days dated to the wrong session. Average daily ranges came out 11% to 23% too small. A strategy tested on that data would size stops and targets for a market that doesn’t exist.
Before you test anything:
- Know your source and its price side. Bid, ask or mid? MT4 and MT5 charts show the bid. Buys open on the ask, so a bid-only test needs a spread added.
- Know when your day ends. Most brokers close the daily candle at 17:00 New York time. A feed that closes at midnight UTC gives you a sixth, Sunday candle, and different daily highs and lows.
- Spot-check against a second source. Pick ten random days and compare highs, lows and closes. A pip or two of difference is normal; ten is a problem.
2. Use bars small enough for your stops
This is the error that produced the +166.5R result. When a strategy’s stop and target both sit inside the range of one bar, the bar can’t tell you which was hit first. Most backtesting tools quietly assume the good outcome.
On hourly bars, the London breakout often triggers, runs to target and could have hit its stop within the same candle. Resolving every such bar in our favour, and skipping the spread, lifted the win rate from 49.0% to 53.3% and the result from −147.8R to +166.5R. On 15-minute bars the same two shortcuts only take it from −135.8R to +6.5R, because far fewer trades are ambiguous.
The rules for bar size:
- Use bars much smaller than your stop. For a 20-pip stop, 1-minute or 5-minute data. For a 100-pip swing trade, hourly is fine.
- When a bar touches both stop and target, count the stop. If your results depend on how you break ties, they depend on luck.
- If your tool can’t tell you how many trades were ambiguous, find out before you trust it.
- Optimistic test
- Honest test
Show the data
| 2016-01-04 | -1R · -1R |
| 2016-05-13 | +3R · -1R |
| 2016-09-29 | -5R · -14R |
| 2017-02-17 | +2R · -14R |
| 2017-06-28 | -6R · -29R |
| 2017-11-14 | +2R · -24R |
| 2018-03-28 | +3R · -27R |
| 2018-08-02 | +5R · -31R |
| 2018-12-24 | -3R · -42R |
| 2019-05-02 | -12R · -58R |
| 2019-09-16 | -19R · -71R |
| 2020-01-27 | -23R · -81R |
| 2020-06-08 | -19R · -81R |
| 2020-10-23 | -16R · -81R |
| 2021-03-09 | -3R · -72R |
| 2021-07-15 | -3R · -77R |
| 2021-11-24 | -15R · -94R |
| 2022-04-05 | -9R · -92R |
| 2022-08-12 | -3R · -89R |
| 2022-12-28 | -19R · -107R |
| 2023-05-10 | -16R · -108R |
| 2023-09-15 | -25R · -120R |
| 2024-01-30 | -27R · -127R |
| 2024-06-10 | -30R · -141R |
| 2024-10-18 | -28R · -146R |
| 2025-03-07 | -7R · -129R |
| 2025-08-08 | -13R · -138R |
| 2025-12-31 | -10R · -140R |
| 2026-05-21 | -6R · -141R |
| 2026-10-12 | +5R · -137R |
| 2026-10-16 | +7R · -136R |
3. Charge every cost
The difference between the third and fifth results above is the spread alone: 1 pip on EUR/USD, charged once per trade. It cost 118R over ten years.
Short-term strategies are hit hardest, because the spread is fixed while the target shrinks with the timeframe. A 1-pip spread is about 2% of an average EUR/USD day, but around 39% of an average 5-minute candle. Our cost study has the numbers by pair and timeframe.
Include:
- Spread, at the level your account actually pays, including wider spreads at the rollover and around news.
- Commission, if you use a raw-spread account.
- Swap, for anything held overnight.
- Slippage on stop orders and stop losses, especially through news. Even half a pip a trade adds up over thousands of trades.
4. Test on data the strategy has never seen
Every time you change a rule after looking at results, you fit the strategy a little more closely to the past. After enough changes it describes history perfectly and predicts nothing.
The defence is to set data aside. Develop the strategy on one period (the in-sample data), then run it once, unchanged, on a later period (out-of-sample). Our London breakout on GBP/USD shows why:
| Period | Result | Profit factor |
|---|---|---|
| 2016–2020 (in-sample) | +35.0R | 1.06 |
| 2021–2026 (out-of-sample) | −72.8R | 0.89 |
A trader who built this system in 2020 would have seen a modest winner. The years that followed lost twice as much as the backtest had made.
Good practice:
- Hold back at least the most recent 30% of your data, and don’t look at it until the rules are final.
- Count how many variations you tried. If you tested 20 and kept the best, its result is mostly selection.
- Prefer rules that work across several pairs and years over rules that are spectacular on one.
5. Read the right numbers
Total profit is the least informative number in a backtest. Look at:
- Number of trades. Under 100 trades tells you very little. Several hundred is a start.
- Average R per trade after costs. This is the edge. Compare it with your cost per trade in R.
- Maximum drawdown in R. Multiply by your risk per trade. Could you live through it?
- Results by year. A strategy that makes everything in one year and loses in the others is fragile.
- Profit factor (gross wins ÷ gross losses). Below about 1.2 after costs, small changes in conditions can wipe it out.
A backtesting checklist
| Check | Question |
|---|---|
| Data | Source, price side and day-end known? Spot-checked against a second source? |
| Bars | Much smaller than the stop? Ambiguous bars counted as losses? |
| Costs | Spread, commission, swap and slippage all charged? |
| Sample | Hundreds of trades over several years and market conditions? |
| Out-of-sample | Final rules run once on data never used to build them? |
| Variations | Number of variants tried recorded, and best-of results discounted? |
| Forward test | Traded small or on demo for at least a few months before scaling? |
A backtest can’t prove a strategy works. Done properly, it can do something more valuable: stop you trading one that doesn’t.
Method: EUR/USD London breakout (Asian range 00:00–07:00 London, stop orders 07:00–11:00, stop at the opposite side, 1R target, exit 16:00 London), January 2016 to October 2026, on Dukascopy 15-minute and 1-hour bid candles. “Optimistic” resolves same-bar stop-and-target touches as wins and charges no spread; “honest” counts them as losses and charges 1 pip per trade.
This article is for education and information, not investment advice. Trading forex and CFDs on margin is high risk and most retail accounts lose money. Read our risk warning.