How spread affects MT5 EA backtests: simulated fills, transaction costs and documenting your tester spread
How the spread assumed by the MT5 Strategy Tester changes entry prices, stop and target triggers, and costs, and why every backtest should record its spread assumptions.

How spread changes what an MT5 backtest reports
Spread affects MT5 EA backtests because the Strategy Tester fills buys at the Ask and sells at the Bid. Whatever bid/ask gap the tester assumes is therefore paid on every simulated trade and shifts every simulated fill. If the assumed spread is tighter than your live conditions, entries look better, stops look safer and costs look smaller than they will be. If it is wider, a workable logic can look broken.
The spread assumption is not a minor setting. It is one of the main inputs that decides whether a test resembles reality. This article covers how the spread enters the simulation, where the tester gets it, and how to document it so a result can be read and reproduced.
Automate this on MetaTrader 5
A MetaTrader 5 expert advisor with documented inputs, full backtest settings and clear risk limits.
Where the spread enters a simulated trade
The tester follows the same price rules as a live account:
- A buy market order opens at the Ask and closes at the Bid.
- A sell market order opens at the Bid and closes at the Ask.
- A buy position's stop loss and take profit are checked against the Bid. A sell position's are checked against the Ask.
- Charts in MT5 are normally drawn from Bid prices, so the Ask line is not visible unless you enable it.
This has three practical consequences in a backtest.
Entry cost
Every round trip starts underwater by the spread. On EURUSD, a 0.8 pip spread versus a 2.0 pip spread is a 1.2 pip difference per trade. Across 500 trades, that is 600 pips of extra cost in the simulation. This is plain arithmetic, not a prediction, but it shows why high-frequency EAs are the most spread-sensitive.
Stop and target triggers
A sell trade's stop is hit when the Ask reaches it. If the spread widens, the Ask can touch the stop while the Bid chart never shows price reaching that level. A tester using a narrow spread will miss these stop-outs. The same applies to sell limit targets on the other side. EAs with tight stops, for example a few pips on EURUSD or a few ticks on an NQ or CL CFD, are affected the most.
Entry conditions themselves
Many EAs have a maximum spread filter. If the tester feeds a spread that never exceeds the filter, the EA trades through every news spike and rollover in the test, even though it would have stayed out live, or the reverse. The filter logic is covered in our guide to MT5 expert advisor risk settings and maximum spread. The point here is that the filter can only be tested with a realistic spread history.
Where the tester gets its spread
The source depends on the modeling mode chosen in the Strategy Tester Settings tab. The modes themselves are explained in MT5 Strategy Tester modeling options. Here is how each relates to spread.
- Every tick based on real ticks: the tester uses the broker's recorded tick history, which contains actual Bid and Ask values. Spread changes during news, session opens and rollover are part of the data, as long as the broker's history is complete.
- Every tick (generated) and 1 minute OHLC: ticks are generated from minute bars, per the MetaTrader 5 tick generation documentation. The spread comes from the value stored with the bar history. One value per minute cannot represent every spread change inside that minute, so short spikes may be smoothed away.
- Open prices only: the coarsest mode. It is useful for fast optimization passes, but it tells you very little about spread sensitivity.
The Strategy Tester help page lists the available settings for your build. Check it and your own Settings tab before assuming a fixed-spread field exists. If your terminal does not offer one for a broker symbol, you can test a fixed or stressed spread with a custom symbol. Custom symbols let you define the symbol properties and import or edit price data. Verify the spread-related properties in the custom symbol's specification dialog rather than relying on defaults.
Spread is only part of transaction costs
A backtest that models spread correctly can still understate costs. Before trusting a historical simulation, list each cost:
- Spread: handled through Bid/Ask as above.
- Commission: charged separately on many raw-spread accounts. Check whether your symbol's history and tester setup apply it. Read the Commission line in the test report instead of assuming it is included.
- Swap: matters for positions held overnight, especially on CL or index CFDs held through rollover.
- Slippage and latency: the tester's execution delay option can simulate delays. Real ticks with a delay are closer to live conditions than instant fills.
A raw-spread account with commission and a standard account with a wider spread can produce different reports for the same EA. Neither is wrong, but they are different tests and should be labeled as such.
A practical spread testing routine
Use this routine to see how sensitive an EA is to spread, without turning it into an optimization exercise.
- Baseline: run the EA on real ticks over a defined period, for example EURUSD M5 over 12 months. Keep the same deposit, leverage and inputs.
- Check the data: open the Journal after the run and confirm the tester used real ticks for the whole range. Note any gaps reported for missing history.
- Stress run: repeat the test on a custom symbol copy with a wider fixed spread, for example your typical live spread plus 50 percent.
- Session check: if the EA trades around the daily rollover or news, compare trade lists to see which trades disappear or flip under wider spread.
- Compare reports, not just net profit: look at the trade count, average trade, the largest loss and the number of stop-outs. A large drop in average trade under a modest spread increase suggests the edge in the test is thin relative to costs.
The goal is not a number to advertise. The goal is to know which spread the result depends on.
Document every spread assumption
A backtest report without its spread assumptions cannot be compared or reproduced. Record these fields next to every saved report:
| Field | Example entry |
|---|---|
| Broker and server | Broker name, demo or live server |
| Account type | Raw spread with commission, or standard |
| Symbol and suffix | EURUSD, EURUSD.raw, custom copy |
| Modeling mode | Every tick based on real ticks |
| Spread source | Recorded tick history, or fixed value on custom symbol |
| Spread value if fixed | Value in points, and why it was chosen |
| Commission and swap | Applied or not, and the rate |
| Execution delay | Setting used |
| Test period and timezone | Dates and server time offset |
| EA version and set file | File name and input preset |
Save the set file with the report. If the EA has a maximum spread input, write down its value, because it interacts directly with the spread source. A ready-made MT5 expert advisor with documented inputs and set files makes this step easier, because each preset is already a file you can attach to the test record.
Common mistakes
- Comparing a generated-tick test with a real-tick test and treating the gap as EA performance.
- Testing on a demo server whose spreads differ from the live account you plan to use.
- Reading net profit while ignoring how many stops were triggered by the Ask on sell trades.
- Forgetting that a symbol suffix such as .raw or .pro can carry different spread and commission conditions.
Conclusion
The spread is built into every simulated fill, stop and target in an MT5 backtest. Prefer real ticks when your broker's history supports it, stress the result with wider spreads, account for commission and swap, and write down exactly which assumptions produced each report. A result you can reproduce is worth more than a result you cannot explain. If you want a robot whose inputs and presets are documented for this kind of testing, explore the MT5 expert advisor at SierraOnShop.
FAQ
Does a profitable backtest with a low spread mean the EA will work on my account?
No. It only shows how the logic behaved under that spread and that data. Live spreads, execution and costs can differ, so treat any backtest as a conditional result, not a forecast.
Why do my results change when I switch brokers with the same EA?
Each broker has its own price feed, spread history, commission model and server time. Different tick histories produce different fills, even with identical inputs.
Should I always test with the widest spread I have seen?
Not as the only test. The extreme spread is useful as a stress case, but a realistic spread history is the better baseline. Run both and compare the results.
Is spread more important for scalping EAs than for swing EAs?
Usually yes, because cost per trade is large relative to a small target and tight stops are more exposed to Ask-side triggers. Longer-holding EAs are often more sensitive to swap.
Can I see the spread the tester used for each trade?
The report lists fill prices. Compare a trade's entry with the Bid chart at that time, or show the Ask line in visual mode, to see the spread applied.
Run it in MetaTrader 5
Written by
Clement
Futures trader for more than seven years, specialized in order book and order flow scalping on US index futures, now building automated strategies. Founder of SierraOnShop.
More about the authorReady to run an expert advisor?
A MetaTrader 5 expert advisor with documented inputs, full backtest settings and clear risk limits.