Page 1 of 1

How I test that an EA respects the maximum spread filter

Posted: Fri Oct 30, 2026 1:45 pm
by FXS London Scalper
My EA has a maximum spread filter. I assumed it worked until I found a trade opened with a spread three times my limit.

The bug: the filter checked the spread at the start of OnTick, but the order was sent after some calculations, and the spread had changed.

How I test it now:
  • Backtest on real ticks with the maximum spread set very low, for example 0.1 pips on EURUSD. The EA should almost never trade. If it does, check those trades.
  • Log the spread both at the check and at order send.
  • Before sending, read the current Ask and Bid again with SymbolInfoTick, and recheck the filter.
After the fix, the logs show no trades above the limit.

Has anyone found other common bugs in spread filters? I suspect many EAs have similar timing issues.