MQL5 EA runtime diagnosis

MQL5 EA Not Opening Trades

If an MQL5 EA is not opening trades, trace one intended entry from event to server result. Confirm OnInit and OnTick run, data is ready, the signal and position filters permit entry, automated trading is enabled, and the completed request passes OrderCheck. Then log OrderSend, GetLastError, result.retcode, and result.comment.

Open the Coding Agent and choose MQL5 from the language menu.

One-line trade outcome record.mq5
ResetLastError();
MqlTradeCheckResult check={};
bool checked=OrderCheck(request,check);
bool sent=checked && OrderSend(request,result);

PrintFormat("checked=%s check=%u sent=%s runtime=%d trade=%u %s",
            checked ? "true" : "false",check.retcode,
            sent ? "true" : "false",GetLastError(),
            result.retcode,result.comment);
  • Program: loaded and receiving events
  • Logic: entry gate becomes true
  • Permission: terminal, EA, account
  • Execution: precheck and retcode

Separate no signal from rejected execution

If OrderCheck is never reached, investigate events, data, signal conditions, time filters, and existing-position guards. If it is reached, investigate the request and returned diagnostics. These paths require different fixes.

Check permissions at three levels

Terminal Algo Trading, the EA program setting, and account EA permission can independently block automated orders. Server-side symbol or account restrictions can add a fourth layer.

  • TERMINAL_TRADE_ALLOWED for the client terminal.
  • MQL_TRADE_ALLOWED for the running program.
  • ACCOUNT_TRADE_EXPERT and ACCOUNT_TRADE_ALLOWED for the account.
  • SYMBOL_TRADE_MODE and current trade session for the symbol.

Validate broker-sensitive request fields

Read symbol volume, tick size, stop level, filling mode, quote, and trade mode immediately before constructing the request. Hard-coded assumptions that worked on another broker or symbol can fail here.

Use a focused diagnostic

The record shows whether the request reached each execution stage. Add the signal values and request fields to connect a rejected trade with the decision that created it.

A valid request can still be rejected or filled differently by the trade server. Check the returned retcode, test with the broker symbol and account, and review risk before any live order.

One-line trade outcome record.mq5
ResetLastError();
MqlTradeCheckResult check={};
bool checked=OrderCheck(request,check);
bool sent=checked && OrderSend(request,result);

PrintFormat("checked=%s check=%u sent=%s runtime=%d trade=%u %s",
            checked ? "true" : "false",check.retcode,
            sent ? "true" : "false",GetLastError(),
            result.retcode,result.comment);
Where Pineify fits

Repair editable MQL5 source with compiler feedback

Pineify can generate or revise MQL5 source and use MQL5 compilation diagnostics during the coding workflow. Keep the exact error, source location, program type, and intended behavior in the request so the change remains reviewable.

Open MQL5 Coding Agent

Pineify does not run your broker terminal, Strategy Tester, market data, or live orders. Validate the final program in your own MetaTrader 5 environment.

Review MQL5 AI Coding Agent capabilities
Pineify MQL5 AI Coding Agent with an editable MetaTrader 5 code artifact

A practical verification workflow

  1. 1

    Prove the EA is active

    Log successful OnInit, OnTick counts, symbol, timeframe, server time, and any early return.

  2. 2

    Expose the entry decision

    Log every named condition and existing-position filter for one intended signal.

  3. 3

    Check permissions and constraints

    Read terminal, program, account, symbol, session, quote, volume, stop, and filling settings.

  4. 4

    Capture request outcome

    Run OrderCheck and record OrderSend, GetLastError, result.retcode, and result.comment.

Frequently asked questions

Why is my MQL5 EA not opening trades with no error?

The EA may never reach OrderSend because an event, data, signal, time, or position gate remains false. Log each gate value before investigating execution errors.

Which permissions can stop an MQL5 EA from trading?

Check terminal Algo Trading, the EA Allow Algo Trading setting, account EA permission, account trade permission, and the symbol trade mode.

Should the EA retry a rejected order on every tick?

No. Diagnose and change the rejected state or field, then use bounded state-aware retries. Unchanged rapid requests can trigger code 10024.

Last verified against the linked official references on . Compile and test the final source in the MetaTrader 5 build, broker, symbol, and account environment you plan to use.

Continue with reviewable MQL5 source

Provide the exact diagnostic and intended behavior, inspect the generated change, compile it, and verify it in your MT5 test environment.

Open MQL5 Coding Agent