MT4 EA Not Opening Trades: Checks, Causes and Fixes
By FXNook Lab team

If your MT4 EA is not opening trades, first find out whether it never reached its order code or whether the broker rejected an order. Check the chart, AutoTrading and EA permissions, then compare the Experts and Journal logs before editing anything. That distinction points you toward the right fix: a signal or filter issue needs code-level tracing, while a rejected OrderSend needs its error and the symbol’s trading constraints checked.
Check the terminal basics first
Start with the settings that can prevent an otherwise valid EA from trading. These checks take a minute and help rule out terminal or account conditions before you investigate the entry logic.
- Confirm the EA is attached to the intended chart. Check the chart’s symbol and timeframe against the EA’s rules. An EA may use the chart symbol and timeframe, or it may contain a hard-coded symbol or timeframe that differs from the chart.
- Turn on AutoTrading. The AutoTrading button in MT4’s toolbar must allow automated trading. If it is off, the EA can still run its calculations, but its trading requests may be blocked.
- Check the EA’s permissions. Open the EA properties on the chart and inspect the Common tab. Make sure Allow live trading is enabled. Also check the terminal’s Tools > Options > Expert Advisors settings for permissions that can disable automated trading.
- Check the account connection and market hours. Look at the connection indicator in the terminal and confirm the symbol is open for trading. A disconnected terminal, a closed market, or a symbol that is not currently tradable can stop an order from being placed or accepted.
- Look at the chart icon. A smiley face generally indicates that the EA is attached and its basic trading permissions are enabled. It does not confirm that the EA’s entry conditions are true, that an order was attempted, or that the broker accepted one.
Do not treat a smiley face as proof that the whole trading path works. It says little about filters, indicator data, lot sizing, margin, stop distances, or broker restrictions. If the icon shows a sad face or a disabled symbol, check permissions first; if it is smiling, continue to the logs and entry logic.
Find out whether the EA skipped a signal or an order failed
Open the Terminal window with Ctrl+T and inspect the Experts and Journal tabs around the time a trade was expected. The Experts tab commonly contains messages printed by the EA and its trading activity. The Journal tab records terminal events such as connection changes and trading permission problems.
Look for evidence of an order attempt, not just a quiet period. An EA may log that a rule failed, print an error after OrderSend, or produce no message at all if it has no diagnostic logging. No order-related message does not prove that the EA is broken; it may simply mean the entry conditions never passed or that the EA does not report skipped signals.
- No entry attempt: There is no order request or rejection around the expected time. Check the signal calculation, filters, new-bar logic and code path that leads to
OrderSend. - Rejected or failed attempt: The log reports an order error, or the EA records a failed
OrderSend. Record the error code and message, then investigate the broker constraint or account condition that caused it. - Order accepted but not visible where expected: Check the account, symbol, trade history and whether the EA is using a different chart or magic number. Make sure you are looking at the right account and terminal.
Write down the timestamp, symbol, timeframe, account type, EA inputs and the complete log line. Include the error number and any details the EA prints about volume, price, stop loss or take profit. These details make it much easier to match a log entry to the exact conditions the EA saw.
Common causes and fixes
Use the table to narrow down common causes. Check the EA’s actual rules and the broker’s settings before changing inputs; a filter may be working as designed even when it prevents a trade.
| Possible cause | What to check | Practical fix |
|---|---|---|
| Entry filters never pass | Review indicator thresholds, trend filters, news or day filters, and any conditions combined with AND logic. | Log each condition separately. Correct a wrong comparison or input only after confirming the intended strategy rule. |
| Wrong symbol or timeframe | Compare the chart with the symbol and timeframe used by the EA’s calculations. Check for hard-coded symbols. | Attach the EA to the intended chart or correct the code to use the intended symbol and timeframe consistently. |
| Not enough price history | Check whether the indicators have the required bars and whether the chart has loaded older data. | Load more history and allow the chart to update. Guard indicator calculations until enough bars are available. |
| Spread or session filter blocks entry | Check the current spread and whether the EA measures it in points or pips. Compare the EA’s hours with broker server time. | Verify units and the server-time window. Adjust a setting only if the intended spread or session rule allows it. |
| Existing-position restriction | Check whether the EA allows only one trade at a time, checks open orders by symbol or magic number, or waits for a position to close. | Confirm the position-count logic is checking the right symbol and magic number, and that the existing trade is handled as intended. |
| Volume outside broker limits | Inspect the requested lots and the symbol’s minimum, maximum and lot step using MarketInfo. | Calculate a valid volume that respects the broker’s limits and the EA’s risk rules. Do not just round up to the minimum without checking risk. |
| Insufficient margin | Check free margin, requested volume, symbol requirements and account conditions. | Understand the volume and margin calculation, then retest with appropriate exposure. Do not remove risk limits to force an order through. |
| Invalid stop distance | Compare stop-loss and take-profit distances with the symbol’s stop level and price precision. | Use valid prices and the broker’s current constraints. Preserve the intended protection rather than deleting stops just to get an order accepted. |
For MT4, the broker’s symbol properties can be queried with MarketInfo. Useful values include MODE_MINLOT, MODE_MAXLOT, MODE_LOTSTEP, MODE_STOPLEVEL and MODE_FREEZELEVEL. A broker can set different limits for different symbols, so a value that works on one pair may fail on another.
Trace the entry conditions in the EA
Read the function that decides whether to trade and follow every condition between the signal calculation and the OrderSend call. Pay attention to early return statements, nested conditions and filters that must all pass. A line that looks harmless can stop every entry if, for example, a spread value is measured in points but the input was chosen as if it were pips.
Indicator timing is another common source of confusion. In MT4, an indicator call such as iMA returns a value for a selected bar shift. Shift 0 is the current, unfinished bar, while shift 1 is the last completed bar. A signal that appears briefly on the current bar can change before the EA acts, and a new-bar check can make the EA evaluate only once per candle. Check that the code’s bar shifts match the strategy rules.
The following MT4 example reports an illustrative moving-average cross and spread filter. It uses completed bars for the cross; it does not send an order. Replace the example conditions with the EA’s real rules when tracing a particular strategy.
input double MaxSpreadPoints = 30.0;
void DiagnoseEntryConditions()
{
RefreshRates();
if(Bars < 10)
{
Print("Entry blocked: not enough chart bars.");
return;
}
double fastLast = iMA(NULL, 0, 5, 0, MODE_EMA, PRICE_CLOSE, 1);
double slowLast = iMA(NULL, 0, 20, 0, MODE_EMA, PRICE_CLOSE, 1);
double fastPrev = iMA(NULL, 0, 5, 0, MODE_EMA, PRICE_CLOSE, 2);
double slowPrev = iMA(NULL, 0, 20, 0, MODE_EMA, PRICE_CLOSE, 2);
bool signal = (fastPrev <= slowPrev && fastLast > slowLast);
double spreadPoints = (Ask - Bid) / Point;
bool spreadOK = (spreadPoints <= MaxSpreadPoints);
Print("Entry check: signal=", signal,
", spreadPoints=", DoubleToString(spreadPoints, 1),
", spreadOK=", spreadOK);
if(!signal)
Print("Entry blocked: no completed-bar moving-average cross.");
if(!spreadOK)
Print("Entry blocked: spread exceeds MaxSpreadPoints.");
}
Call a diagnostic function at the same point in the EA where entry decisions are made, and avoid printing an unhelpful flood of identical messages on every tick. For each real condition, report the observed value, the required value and whether the condition passed. This makes it possible to distinguish an indicator that never produces a signal from a signal that is later stopped by a spread, time or position filter.
Capture and interpret the OrderSend result
In MT4, OrderSend returns a ticket number when the request succeeds and -1 when it fails. Capture GetLastError() immediately after a failure so that you record the error from that request. The example below shows the result handling for a market buy; use it only inside the EA’s intended order path and with its own valid volume, price and protection values.
RefreshRates();
ResetLastError();
int ticket = OrderSend(Symbol(), OP_BUY, lots, Ask, slippage,
stopLoss, takeProfit, "EA entry", magicNumber, 0, clrBlue);
if(ticket < 0)
{
int errorCode = GetLastError();
Print("OrderSend failed. symbol=", Symbol(),
" lots=", DoubleToString(lots, 2),
" error=", errorCode);
}
else
{
Print("OrderSend accepted. ticket=", ticket,
" symbol=", Symbol());
}
The variables lots, slippage, stopLoss, takeProfit and magicNumber must already be declared in the EA. A successful ticket means the request was accepted; it does not replace checking the resulting trade and its protection in the terminal. If a request fails, preserve the original values and log them before trying a change.
- Error 131, invalid trade volume: The requested lots do not fit the symbol’s permitted volume rules. Compare the value with
MODE_MINLOT,MODE_MAXLOTandMODE_LOTSTEP. - Error 130, invalid stops: A stop-loss or take-profit price is invalid or too close under the broker’s stop-distance rules. Check price direction, digits, point size and
MODE_STOPLEVEL. Some brokers can have a floating restriction, so a reported zero stop level does not always settle every rejection. - Error 134, not enough money: The account does not have enough free margin for the requested trade. Check volume and margin conditions rather than bypassing risk controls.
- Error 146, trade context busy: The terminal’s trade context is occupied. Review whether the EA is making overlapping requests or retrying too quickly; do not create an uncontrolled retry loop.
Other useful errors include 132 for market closed, 133 for trade disabled, 136 for off quotes and 138 for requote. The exact message and surrounding log lines matter: a transient price problem calls for different investigation from a permanent volume or permission problem. If there is no failed OrderSend result in the logs, go back to the entry path instead of assuming the broker rejected a request.
Do not loosen a spread filter, remove stop losses or increase volume simply to make an order succeed. First identify whether the EA’s values are wrong, the broker’s constraints are being read incorrectly, or the market conditions do not meet the rules. A change that makes an order acceptable can also change the EA’s risk behavior.
Retest in Strategy Tester and on demo
Once you have a specific cause and a specific change, test it in a controlled order. A single successful trade is not enough to establish that the EA’s other rules still behave as intended. Past or tested results do not guarantee future ones.
- Reproduce the original setup in Strategy Tester. Select the same EA, symbol, timeframe, inputs and an appropriate test period. Use data that covers the condition you are investigating, such as the relevant session or spread behavior.
- Read the tester log. Inspect the Strategy Tester’s Journal and any EA messages. Confirm that the expected signal and filters were evaluated, then check whether the order was accepted or which error was returned.
- Verify the rules around the change. Check that entries happen only when the intended conditions pass and that stop-loss, take-profit, position-count and volume rules still apply. If you changed a filter, confirm it still blocks the cases it was designed to block.
- Forward-test on a demo account. Demo conditions let you check the live terminal’s permissions, server time, symbol settings and logs without risking a live order. Observe the EA for enough relevant market conditions to see whether the original issue recurs.
- Keep the before-and-after record. Save the original inputs and relevant logs, and note the exact code or setting change. If behavior differs from the tester, compare quotes, spread, session time and broker symbol constraints.
When to debug further or get the EA reviewed
If the logs do not show whether a signal was skipped or an order failed, the EA needs clearer diagnostics. Gather the .mq4 source file if available, exact symbol and timeframe, EA inputs, account type, timestamp and relevant Experts and Journal lines. Include tester settings and results, plus the requested lot size and stop prices if an order was rejected.
A code review helps when the entry path is hard to follow, a filter combination may be impossible, or the EA’s order handling does not log its inputs and return value. FXNook AI Code Lab’s EA debugger can inspect an uploaded EA’s trading path and identify what stops it from trading. If the EA’s code is understood but you need to see which rule blocks entries while it runs, FXNook Telemetry reports rules, decisions, orders and errors; it observes the EA and does not trade.
The practical next step is to capture one specific time when a trade should have happened, then match that moment to the EA’s rules and the Experts or Journal log. If those records still do not show where the entry path stops, use the EA debugger to investigate the code before changing trading safeguards.
Questions
Why does my MT4 EA show a smiley face but not trade?
The smiley face generally means the EA is attached and basic automated-trading permissions are enabled, not that its entry rules have passed. Check the Experts and Journal tabs, then trace filters, signal timing, symbol settings and position limits to see whether an order was attempted.
Where can I find MT4 EA error messages?
Open the Terminal window with Ctrl+T and check the Experts and Journal tabs around the time the EA should have traded. The Experts tab often contains EA messages and order errors, while the Journal records terminal events such as connection or permission changes.
How do I fix OrderSend error 130 in MT4?
Error 130 means the order has invalid stops, often because a stop-loss or take-profit is too close or has an incorrect price. Check the order direction, symbol precision and broker stop-distance rules, including MODE_STOPLEVEL; do not remove protective stops without understanding the effect on the EA.
Can an MT4 broker prevent an EA from opening trades?
Yes. A broker or account can reject trades because a symbol is closed or disabled, volume or stops are outside permitted limits, or margin is insufficient. Read the OrderSend error and compare the EA’s request with that symbol’s broker constraints before changing the code.