Page 1 of 1

Building a max spread filter for gold in MT5

Posted: Tue Oct 20, 2026 5:15 pm
by FXS London Scalper
Gold spreads vary a lot through the day. A max spread filter stops your EA or manual workflow from entering when spread is unreasonably wide.

Basic MQL5 logic:

Code: Select all

double spread = (SymbolInfoDouble(_Symbol, SYMBOL_ASK) - SymbolInfoDouble(_Symbol, SYMBOL_BID));
if(spread > MaxSpread) return; // skip entry
Things to get right:
- Units: gold spread in price units (e.g. 0.25 = 25 cents), not points. Check the symbol's digits.
- Value: what's "too wide"? Base it on your own spread data by hour. A fixed value might be too strict in Asia and too loose during London.
- Timing: check spread immediately before sending the order, not at the start of the bar.

Refinements:
- Hour-dependent thresholds: a table of max spread per hour.
- Relative threshold: skip if current spread > 2x the median of the last 100 ticks.
- Log every skipped signal, so you can check later whether the filter is too tight.

What spread threshold do you use for gold?

Re: Building a max spread filter for gold in MT5

Posted: Sat Oct 31, 2026 9:17 pm
by Shadow Trader
Brokers often say their servers are in London, New York, or Tokyo. That's true, but it leaves out the building. In London, the main FX hub is Equinix LD4 in Slough. In New York, it's NY4 in Secaucus. In Tokyo, TY3 or a nearby facility.

A VPS in a data center in the same city might be 30 km from the broker's matching engine. That's a fraction of a millisecond in theory, but real network paths aren't straight. Packets pass through multiple routers, and the actual delay can be 5 to 15 ms.

A VPS in the same building, connected through a cross-connect or the same network switch, can bring the round trip to under 1 ms.

Some VPS providers specialize in this, advertising "in the same data center as brokers". The claim is worth checking with an actual ping to the trade server IP, not a general one to the broker's website, which often sits elsewhere.

The advantage only matters for certain strategies. A 3 pip target on a 1 minute chart won't care about 10 ms. A 0.5 pip target on tick-level signals will.

Honestly assessing which kind of strategy is running is the first step, before paying for a premium location.

What ping to the actual trade server has been achieved, and did the improvement show up in the results?