Giving a backtest a different spread for each hour of the day
Posted: Wed Oct 21, 2026 1:23 pm
Giving a backtest a different spread for each hour of the day
Most backtests use a single fixed spread or the spread recorded in the historical data. Both can be misleading for a scalping strategy.
A fixed spread assumes the cost of trading at 03:00 is the same as at 09:00. It isn't. On EURUSD the spread during London can be a fraction of what it is just after the New York close. A strategy that trades at all hours will look better in the test than it would live, because the expensive hours are priced as if they were cheap.
Historical spread data in tick files is better, but it comes from a particular broker at a particular time. Your broker's spreads may differ, especially in the quiet hours where differences between brokers are biggest.
A practical middle ground is to build an hourly spread profile from your own broker. Record the spread on each pair every minute for a few weeks, then calculate the median and a high percentile for each hour of the day. In the backtest, apply the spread for the hour the trade happens in, not a single value.
If your tester doesn't support this directly, you can apply it in your own result processing. Take the trade list, look up the hour, subtract the extra cost. It's not perfect, but it's much closer to reality than one number for the whole day.
Using the high percentile instead of the median gives a more conservative test. If the strategy survives that, it has a better chance live.
Most backtests use a single fixed spread or the spread recorded in the historical data. Both can be misleading for a scalping strategy.
A fixed spread assumes the cost of trading at 03:00 is the same as at 09:00. It isn't. On EURUSD the spread during London can be a fraction of what it is just after the New York close. A strategy that trades at all hours will look better in the test than it would live, because the expensive hours are priced as if they were cheap.
Historical spread data in tick files is better, but it comes from a particular broker at a particular time. Your broker's spreads may differ, especially in the quiet hours where differences between brokers are biggest.
A practical middle ground is to build an hourly spread profile from your own broker. Record the spread on each pair every minute for a few weeks, then calculate the median and a high percentile for each hour of the day. In the backtest, apply the spread for the hour the trade happens in, not a single value.
If your tester doesn't support this directly, you can apply it in your own result processing. Take the trade list, look up the hour, subtract the extra cost. It's not perfect, but it's much closer to reality than one number for the whole day.
Using the high percentile instead of the median gives a more conservative test. If the strategy survives that, it has a better chance live.