Ballast Spread Guard
- Utilità
- Versione: 1.10
- Aggiornato: 24 novembre 2026
- Attivazioni: 5
Stop losing trades to the spread. At rollover and around news the spread can jump to ten or twenty times its usual size for a minute: pending orders fill at bad prices and stop-losses get hit although the price never went there. Ballast Spread Guard steps aside while the spread is wide and puts everything back when it is normal again.
Attach it to one chart. It watches the spread of that symbol (or a list of symbols) and acts on all their orders, manual or from any EA. It never opens a trade.
- Knows what "wide" is: the typical spread is the median of the last 24 hours, so the limit adapts to each symbol and broker. Wide = spread above 3x typical (or a fixed number of points). Normal again only after 60 seconds below the limit, so it does not flicker on and off.
- Lifts pending orders while the spread is wide and places them again afterwards with the same price, stop, target, volume, expiry, comment and magic number. An order whose price was passed meanwhile is not placed again (it would fill at once) and is reported. Orders that are only too close to the price wait until the broker accepts them.
- Shields stop-losses: a stop the wide spread could reach is moved further out (20x typical spread) as a safety stop at the broker, and the guard watches the real stop on the normal-spread price. If the market really reaches it, the trade is closed at market. When the spread is normal the stop goes back exactly where it was. If you change the stop yourself, the guard leaves it alone.
- Optional: close trades opened while the spread is wide; alert and push notification when the spread turns wide; only one magic number.
- Spread log for every weekday hour (average, maximum, minutes wide) in MQL5\Files\SpreadGuard_<symbol>.csv. The panel shows the most expensive hours of your broker, so you know when not to trade.
- For other EAs: the global variable SpreadGuard_<symbol> is 1 while the spread is wide.
Tested
- Eight one-year runs on real ticks (EURUSD and Gold, November 2025 to October 2026, every real spread spike of the broker), each with the guard off and on, with a random trader placing trades and pending orders. An independent tracker computed the spread state on every tick and checked every fill and every stop-out.
- Spread state: 2,578 wide spells, 0 ticks where the guard and the tracker disagreed.
- Pending orders filled while the spread was above the limit: 345 without the guard, 155 with it. All 155 filled on the first tick of a spike, before any tool can react; later inside a wide spell it was 191 and 0. 14,155 orders lifted, 13,895 placed again identical, 0 different, 248 not placed again because the price had passed them, 12 still waiting when the tests ended.
- Stop-outs caused only by the spread: 1,107 without the guard, 903 with it (inside a wide spell 171 and 0). The remaining ones came from a spread below the limit or from the first tick of a spike. On Gold the total hardly changed (592 and 582).
- Shielded stops compared with what the original stop would have done: EURUSD: 619 stops reached, 264 ended better, 197 worse, on average 30 points better. Gold: 56 stops reached, 4 better, 24 worse: no benefit in these tests, so on Gold consider turning "Shield stop-losses" off and using only the order lifting.
- Average loss per losing trade stayed at the planned risk (1.01x on EURUSD, 1.04x to 1.05x on Gold). Large single losses are not prevented: losses above 1.5x the plan were 137 without and 148 with the guard; the largest (17.7x on Gold) came from a weekend gap.
- Not avoidable: the very first tick of a spike, spread rises below the limit, and weekend gaps. Results are from one broker; spreads differ between brokers.
Notes
- A restored pending order gets a new ticket number. If an EA tracks its own pending orders by ticket, keep it out with "Only this magic number" or turn off "Lift pending orders".
- While a stop is shielded, the guard must be running (keep the terminal on, e.g. on a VPS). If it is not, the safety stop at the broker still protects the trade, further out.
- When the market really reaches a shielded stop during a spike, the trade is closed at market and pays part of the wide spread. Weekend gaps are not affected by any stop.
- In the Strategy Tester the demo opens a trade and a pending order before the nightly rollover so you can watch the guard work (choose "Every tick based on real ticks"). On a real chart it never opens trades.
Inputs
- Wide when spread > this x typical spread — 3 (0 = off)
- Wide when spread > this many points — 0 = off
- Normal again after this many seconds below the limit — 60
- Symbols — e.g. EURUSD,GOLD; empty = this chart only
- Lift pending orders, restore them afterwards — true
- Shield stop-losses — true
- Shielded broker stop: this x typical spread further out — 20
- Close trades opened while the spread is wide — false
- Only this magic number — -1 = all, 0 = manual trades
- Alert / push notification when the spread turns wide — false
- Panel font size, corner — 9, upper left
Works well with
- Ballast News Shield — closes trades and blocks trading around high-impact news
- Ballast Stealth Stops — hidden stop-loss and take-profit with a wider emergency stop
- Ballast OCO Orders — one-cancels-other pending orders and a one-click straddle
