How to plan a spread filter for an MQL5 EA

A spread filter is a focused first customisation: it gives a clear answer to one question, whether new entries should be allowed at the current spread. Define that boundary before editing the EA.

Write an exact rule

Specify the unit, the maximum accepted value and the equality rule. For example, an illustrative rule might allow a new entry when the spread is less than or equal to a named limit in points. Decide what happens when the quote is unavailable. Keep protective management of existing positions outside a blanket entry-only filter.

Read one coherent quote

SymbolInfoTick returns a snapshot containing Bid and Ask. For a valid quote, a points-based spread is the Ask-minus-Bid price difference divided by the symbol’s point size. Check the function result and the point value before calculating. Avoid combining an old Bid with a newly fetched Ask.

Put the filter at the entry boundary

Locate the point where a valid strategy signal becomes a new-entry request. Place the check there, using a clearly named input and a concise diagnostic reason when an entry is skipped. Do not accidentally bypass exits, trailing logic or pending-order management that the strategy still requires.

Test the boundary cases

  1. A spread below the limit.
  2. A spread exactly at the limit.
  3. A spread above the limit.
  4. A missing or invalid quote.
  5. An existing position that still needs management while entries are blocked.

Make it yours with MQLume

MQLume is built for this kind of ownership: start with editable source and make a specific improvement. Explore My AI Gold MT5 and use the AI prompt checklist to describe the change clearly.

Sources and further reading

Back to top

Inspect the source projects

Review the delivered release, input guide and documented testing scope for each package.

Quantum Titan MT5The Gold Reaper MT5My AI Gold MT5Ultimate Breakout System MT5Quantum Commander MT5

Cart

One personal-use licence per project. Each project can be added once.

Your cart is empty

Choose a source project to get started.

Continue shopping