Guides

How to Fix a Broken MT4 or MT5 Expert Advisor

Diagnose a broken MT4 or MT5 expert advisor, separate code errors from broker and configuration problems, and prepare the evidence needed for an efficient MQL repair.

13 MAY, 2026 .6 min read
MetaTrader MQL Code Repair
MQL Code Repair and Expert Advisor Debugging Guide featured image

Moore Tech Insight

Fixing a broken MT4 or MT5 expert advisor is rarely just a syntax problem. An EA can fail because of MQL code, broker settings, symbol naming, order rules, timeframe assumptions, installation, permissions, or differences between backtests and live behavior.

Moore Tech offers MetaTrader programming for MQL4, MQL5, expert advisors, indicators, repairs, conversions, and broker-aware workflow tools.

Fast EA troubleshooting checklist

  1. Confirm the EA is installed in the correct MT4 or MT5 data folder and compiled for that platform version.
  2. Check the Experts and Journal logs for the first error, not only the last repeated message.
  3. Verify automated trading permissions at the terminal, account, and EA levels.
  4. Confirm symbol names, suffixes, lot steps, stop distances, trading sessions, and account type with the broker.
  5. Reproduce the problem with exact inputs, timeframe, symbol, date range, and expected behavior.
  6. Compare Strategy Tester behavior with a documented live or demo example.

If you only have a compiled .ex4 or .ex5 file, the original source may be required. A compiled file is not a substitute for editable MQL4 or MQL5 source code.

What counts as MQL repair

Repair usually means the indicator or expert advisor already exists, but something is failing.

Common MQL repair requests include:

  • compile errors in MQL4 or MQL5
  • expert advisor entries or exits that do not match the rules
  • indicator buffers that plot incorrectly
  • broker-specific execution or symbol problems
  • MT4 code that needs modernization or MT5 conversion review
  • old EA logic that needs cleanup before new features are added

Send the source files if you have them. An .ex4 or .ex5 file alone may not be enough to repair the logic.

What to send for EA debugging

Expert advisor debugging needs more context than an indicator repair because order behavior depends on broker rules and account conditions.

Send:

  • MQL source files
  • MT4 or MT5 version
  • broker and account type, if relevant
  • symbol names and timeframe
  • Strategy Tester settings
  • screenshots of inputs and wrong behavior
  • journal or expert log excerpts
  • examples of expected entries, exits, stops, or targets

If live behavior differs from backtest behavior, include both examples.

Broker behavior matters

MetaTrader projects often depend on details outside the script itself: lot step, minimum stop distance, spread behavior, symbol suffixes, execution model, and market hours.

If the EA works on one broker and fails on another, that is important debugging information. The code may not be broken; it may be making assumptions that only work in one broker environment.

Repair, conversion, or rebuild

A rebuild may be better when the source is incomplete, the strategy rules are unclear, the code was heavily modified by multiple people, or the current structure cannot safely support the requested changes.

The repair review should identify whether the fastest path is a small fix, cleanup, conversion, or a clean build.

Practical next step

Start with MetaTrader programmer services when you have broken MQL code, a failing expert advisor, or a broker-specific behavior problem. If the scope is still unclear, use the MetaTrader MQL scope checklist first.