Advertisement IC Markets

Backtests Without Spreads Are Fiction

Share, develop, and backtest custom MQL4/MQL5 Expert Advisors, Python data-scraping scripts, trading bots, and automated market alert systems.
Post Reply
Fairman
Posts: 6955
Joined: Tue Jul 21, 2026 7:11 am
Location: Abuja

Backtests Without Spreads Are Fiction

Post by Fairman »

Backtests Without Spreads Are Fiction

A backtest that ignores trading costs can make nearly any short-term strategy look profitable. Costs are the quiet difference between theory and reality.

Take a scalping strategy that trades 10 times a day for an average gain of 1.5 pips before costs. If the spread plus commission costs 1.2 pips per trade, the net is 0.3 pips per trade. A small error in cost assumptions, like a spread that is 0.5 pips wider during certain hours, turns it negative.

Realistic cost modeling includes several elements. Use variable spreads if your data supports it, because spreads widen at rollover, news, and low liquidity. Include commission per lot. Account for slippage on stop orders and market orders, perhaps by adding a fixed pip penalty. Include swap on trades held overnight.

Also pay attention to the data. Bar-based tests cannot show what happened within a bar. If both your stop and target lie inside the same candle, the test cannot tell which came first, and software often assumes the favorable one. This flatters results.

Tick data helps, though quality varies.

When in doubt, make assumptions conservative. A strategy that survives pessimistic costs is more likely to survive live trading.

Practical step: rerun your latest test with spreads increased by 50 percent and see whether the expectancy remains positive.
It’s Fairman :geek:
Recommended broker for automated trading & scalping IC Markets
Fairman
Posts: 6955
Joined: Tue Jul 21, 2026 7:11 am
Location: Abuja

Re: Backtests Without Spreads Are Fiction

Post by Fairman »

For scalping I'd also log the spread at the moment of each entry in your live journal. After a few weeks you'll know your real average cost per trade, and you can plug that straight back into the test instead of guessing.
It’s Fairman :geek:
Fairman
Posts: 6955
Joined: Tue Jul 21, 2026 7:11 am
Location: Abuja

Re: Backtests Without Spreads Are Fiction

Post by Fairman »

The bar ambiguity point catches a lot of people. If your platform has an option for worst case when stop and target are in the same candle, turn it on. If the system still works, good sign.
It’s Fairman :geek:
Shadow Trader
Posts: 5594
Joined: Wed Sep 09, 2026 5:19 pm

Re: Backtests Without Spreads Are Fiction

Post by Shadow Trader »

Fairman's example sits on a knife edge. Split the 1.2 pips into 0.6 of spread and 0.6 of commission, and the suggested 50% wider spread takes the 0.3 pip net exactly to zero.
img_12993_r1.png
img_12993_r1.png (93.02 KiB) Viewed 264 times
The chart runs the same strategy on two cost structures as the spread multiplier rises. On a commission free account where all 1.2 pips is spread, the edge is gone at only 25% wider spreads, because the whole cost scales.

The bigger issue is that spread is not independent of the signal. Breakout entries cluster at the open and around releases, which is exactly when spreads are widest, so a test using the day's average spread understates the cost of the trades the system actually takes.

That is why the entry spread log matters most. Comparing the spread at signal time with the session average tells you whether the strategy has a habit of trading at the worst moments.

On the bar ambiguity point, the worst case option is a good start, but it should apply to break even stops too. A bar that tags the target and the moved stop gives two different results depending on order, and the favourable assumption flatters scalping tests most.
FXS Prop Desk
Posts: 1689
Joined: Wed Oct 07, 2026 9:52 am

Re: Backtests Without Spreads Are Fiction

Post by FXS Prop Desk »

The example shows why costs matter so much for scalpers. Worth stressing: costs should include slippage too, not only spread and commission. Adding a conservative estimate, such as a few tenths of a pip per trade on major pairs, to the backtest gives a more realistic picture, especially for strategies that use market orders or stop entries.

Swaps should be included as well for strategies that hold overnight.
FXS Official Team | The Idea Lab & Strategy
Shadow Trader
Posts: 5594
Joined: Wed Sep 09, 2026 5:19 pm

Re: Backtests Without Spreads Are Fiction

Post by Shadow Trader »

One cost that often gets entered wrong is commission. Brokers quote it per lot per side or per round turn, and a 3.5 dollar per side rate is 7 dollars round trip, or 0.7 pips on EURUSD. Typing 3.5 into a tester field that expects round turn quietly halves the cost.

Rollover deserves its own test window. Between roughly 21:00 and 22:00 GMT spreads on many pairs widen to several times normal, so an EA that trades the early Asian session can look fine on average spreads and still pay most of its costs in that one hour.

A stress run I rate above the flat 50 percent bump is cutting out the best trades. Remove the top 5 percent of winners by pips and rerun with realistic costs, and if expectancy flips negative, the system leans on a few lucky fills.

Slippage is not symmetric for a scalper either. Stops and market entries take the negative side, while limit targets usually fill at the level, so a fixed penalty belongs on stop exits and entries rather than on every trade.

Fairman, when you rerun with wider spreads, do you widen them evenly across the day? Or weight the widening toward the hours where the entries actually cluster?
Shadow Trader
Posts: 5594
Joined: Wed Sep 09, 2026 5:19 pm

Re: Backtests Without Spreads Are Fiction

Post by Shadow Trader »

A backtest that cannot be repeated is closer to an anecdote than a measurement. Re-running the same code a month later and receiving different numbers is common, and the cause is frequently the data rather than the logic.

Data sources change silently. A vendor may correct historical ticks, a platform may download extra history that alters earlier bars, or a symbol's trading hours may be redefined. Any of these shifts signals and fills slightly, and the differences compound across thousands of trades. Saving a dated snapshot of the exact files used, with a checksum, removes that moving part.

Other sources of variation include random elements in the test itself, such as simulated slippage or shuffled trade order. Fixing the random seed and recording it makes those runs comparable. Software versions of libraries can also change calculations, so a note of the environment helps.

A tidy record per run ties these together: data snapshot identifier, code version, parameter set, cost assumptions and seed. With that record, a surprising result can be investigated instead of debated, and an improvement can be credited to a genuine change rather than to drifting inputs. Without it, comparing two test runs is often comparing two different experiments.
Post Reply