Strategy testing and trading software · Germanycontact@stratcorealpha.com · DE
All trading software errors

MT5 · code and request checks

MT5 EA not opening trades: trace the first missing step

Separate “the rule did not trigger”, “the request was blocked”, and “the request was rejected”. Log the first missing step. A working tester report does not establish that the same event, data and account permissions existed in the other environment.

Arnold Holm · 2026-10-06 · Source-backed checks, no trading-result promise.

What the error means

An Expert Advisor is a program that applies your trading rules in MetaTrader. No new position is an observation, not an error code. Preserve the journal, symbol, decision time and exact source version before deciding whether the fault is in the rule, the environment or the order path.

Three code paths to check

  1. 1. The intended event or eligible signal never arrived

    OnTick is driven by ticks of the chart symbol where the EA is attached. A multi-symbol strategy must define how it receives and checks other symbols. Record the decision time, symbol, required data and the reason each entry condition passed or failed. Disabling AutoTrading does not stop OnTick; it prevents the EA from sending trading requests.

  2. 2. The terminal, EA or account blocks the request

    Read terminal connectivity and trading permission, MQL_TRADE_ALLOWED, and the account permissions ACCOUNT_TRADE_ALLOWED and ACCOUNT_TRADE_EXPERT. Keep these as separate facts. A permission flag alone does not establish that the symbol, session, margin and intended order type allow the complete request. Do not change account permissions merely to hide the failed case.

  3. 3. A successful function call was mistaken for execution

    Keep the populated request and the MqlTradeResult.retcode and comment. OrderSend returning true means the basic request checks passed; it is not proof of an executed deal. Check the relevant trade transaction and the intended order or position. Do not automatically send a second request because a position was not immediately visible.

Own pattern: record the permissions without sending an order

Call this beside the decision path in your authorised source. Add your own rule-specific pass/fail reasons before the existing request call. This helper reads and prints context only. It does not enable trading, place orders, modify stops or retry a request.

void LogTradingContext(const string symbol)
{
   Print("symbol=", symbol,
         " decision_time=", TimeToString(TimeCurrent(), TIME_DATE|TIME_SECONDS));
   Print("connected=", TerminalInfoInteger(TERMINAL_CONNECTED),
         " terminal_trade=", TerminalInfoInteger(TERMINAL_TRADE_ALLOWED),
         " ea_trade=", MQLInfoInteger(MQL_TRADE_ALLOWED));
   Print("account_trade=", AccountInfoInteger(ACCOUNT_TRADE_ALLOWED),
         " account_expert=", AccountInfoInteger(ACCOUNT_TRADE_EXPERT));

   long trade_mode = 0;
   ResetLastError();
   bool read = SymbolInfoInteger(symbol, SYMBOL_TRADE_MODE, trade_mode);
   int error = GetLastError();
   PrintFormat("symbol_mode_read=%s mode=%I64d terminal_error=%d",
               read ? "true" : "false", trade_mode, error);
}

This is a source-level integration pattern, not a compiled EA or a recorded broker run. Permission readings can change after the log. A permitted context does not validate price, stops, volume, margin or the later transaction. Freeze the symbol, account type, source and three cases before testing on an authorised demo account.

Three cases to agree before calling it fixed

Positive case: an eligible signal reaches the request path

The agreed demo fixture supplies the required data and an eligible signal. The log identifies the decision and permissions, then the separately approved request path records the server result and resulting order or position. Compare those facts with the rule; do not accept a true function return alone.

Negative case: no signal or trading not permitted

Keep the missing condition or permission visible. The entry path records that reason and creates no new request. No silent permission change, disabled protection or repeated submission is accepted as the fix.

Boundary case: another symbol ticks or the server result arrives later

For a multi-symbol rule, demonstrate the defined data/event path instead of assuming every symbol invokes this chart’s OnTick. For delayed execution, retain the original request identifier and follow its transaction. A missing immediate position must not create a duplicate request.

Your own source

Find the next line to check

Start with the free EA-Check. Your code stays in your browser. It highlights patterns with line numbers; it does not prove the broker accepts an order.

Check my EA locally

Want one small change shown on your own case?

SOLVED-FIRST: one small fix or change to your own case, shown first as screenshots or a short screen video. 15 USD fixed (or the higher platform minimum), first five paid orders only during 4–17 October 2026. The file follows within 24 hours after funding. Close on Upwork first; marketplace cases stay on their marketplace.

Outside that sprint: R49: one authorised, reproducible MT4/MT5 defect, with three agreed cases. 49 USD fixed. Delivery within 48 hours after source review and funding. The exact case is agreed before funded work.

Send the expected and actual behaviour

Common questions

Should I enable AutoTrading and assume the issue is fixed?

First record whether trading was actually blocked. A changed permission cannot establish that the intended trigger, request or resulting position is correct. Test the agreed positive, negative and boundary cases.

Why does the tester work while the other environment does not?

The observations may use different symbols, event timing, history, account permissions or server responses. Preserve those differences and locate the first missing step. Do not infer a specific cause from the tester result alone.

Does no trade mean the strategy is unprofitable?

No. This guide concerns program behaviour and request state. It makes no claim about profit or challenge passing.

Sources and limits

The linked forum case belongs to its author. It is not my customer case or proof that your broker has the same cause. This article covers request behaviour only; it makes no performance or challenge-passing claim.

Trading risk disclosure

Futures and forex trading contains substantial risk and is not for every investor. An investor could potentially lose all or more than the initial investment. Risk capital is money that can be lost without jeopardizing one's financial security or lifestyle. Only risk capital should be used for trading, and only those with sufficient risk capital should consider trading. Past performance is not necessarily indicative of future results.

Hypothetical performance disclosure

Hypothetical performance results have many inherent limitations. No representation is being made that any account will or is likely to achieve profits or losses similar to those shown. There are frequently sharp differences between hypothetical performance results and the actual results subsequently achieved by any particular trading program. Hypothetical results are generally prepared with the benefit of hindsight, do not involve financial risk, and cannot completely account for the impact of financial risk in actual trading. Market conditions, the ability to withstand losses, and adherence to a trading program can all materially affect actual results.

NinjaTrader trademark disclosure

NinjaTrader® is a registered trademark of NinjaTrader Group, LLC. No NinjaTrader company has any affiliation with the owner, developer, or provider of the products or services described herein, or any interest, ownership or otherwise, in any such product or service, or endorses, recommends or approves any such product or service.

Testimonials, when shown, may not represent the experience of other clients and are not a guarantee of future performance or success. Virtual-currency trading carries additional risks. See the CFTC customer advisories. Read the full financial risk disclaimer.