Table of Contents
- Why is my MT5 Expert Advisor not opening trades? Start with this diagnosis table
- Is the Algo Trading button switched on? (retcode 10027)
- Is 'Allow Algo Trading' ticked in the EA's own settings? (error 4752)
- Did MT5 turn off algo trading when you switched account, profile or chart?
- Are you logged in with the investor password?
- Is algo trading blocked on the server side? (retcode 10026)
- Can the symbol be traded right now? (10017, 10044, 10018)
- Is the EA actually running?
- Did the EA decide not to trade, or send an order the server rejected?
- MT5 Expert Advisor not working? Quick checklist before you contact support
- FAQ
- What is the difference between retcode 10027 and error 4752 in MT5?
- Is MT4 error 4109 the same as the MT5 errors?
- What is algo trading in MT5?
- Does an Expert Advisor need a VPS?
- Can I run an Expert Advisor on the MT5 web terminal or MT5 for iOS and Android?
- Does LHFX allow Expert Advisors?
- Learn
- MT5 Expert Advisor Not Working? 8 Causes and Fixes
MT5 Expert Advisor Not Working? 8 Causes and Fixes

Why is my MT5 Expert Advisor not opening trades? Start with this diagnosis table
Your Expert Advisor (EA) is attached to the chart, price is moving, and no trades open. The usual cause of an MT5 Expert Advisor not working this way is a permission switch, and MT5 often writes the reason in the Toolbox.
Press Ctrl+T to open the Toolbox, then read two tabs. The Experts tab shows messages the EA itself prints. The Journal tab shows messages from the terminal, such as logins and algo trading being switched on or off.
Each order the EA sends gets a numbered reply, called a return code or retcode (10027, for example), and the EA or terminal logs it in one of those tabs. Match what you see to a row in this table.
What you see | Likely cause | Fix |
"AutoTrading disabled by client" or retcode 10027 | The Algo Trading button on the toolbar is off | |
Error 4752 "Trading by Expert Advisors prohibited" | Allow Algo Trading is unticked in the EA's own settings | |
Trading stopped right after you switched account, profile, symbol or timeframe | An option that disables algo trading on those changes | |
"Trade is disabled" on every order, manual ones included, or a greyed-out order window | You logged in with the investor (read-only) password | |
"Autotrading disabled by server" (10026) | Algo trading is restricted on the server side | |
10017 "Trade is disabled", 10044 close only, or 10018 "Market is closed" on one symbol | That symbol cannot be traded right now | |
No messages at all, and a grey cap (hat) icon on the chart | The EA is loaded but blocked from trading | |
No messages at all, and no EA icon or name on the chart | The EA is not running | |
EA running (blue icon), with messages about volume, stops, money or filling (10014, 10016, 10019, 10030), or a blue icon and no messages | The EA chose not to trade, or sent a request the server rejected |
If both tabs are empty and the EA still isn't trading, work through the sections below in order. They run from the quickest check to the slowest.
Is the Algo Trading button switched on? (retcode 10027)
The MT5 Algo Trading button on the main toolbar is the terminal-wide switch for automated trading. When it is off, every EA on every chart is blocked from trading. Each order the EA sends comes back with retcode 10027, TRADE_RETCODE_CLIENT_DISABLES_AT, which the MQL5 trade return codes define as "Autotrading disabled by client terminal". In the Experts tab you will usually see the shorter log line AutoTrading disabled by client.
To tell if algo trading is on in MT5, look at the icon on the toolbar button. A green play icon means on. A red stop icon means off. This is a different icon from the cap (hat) in the chart's top-right corner, which turns blue when an EA on that chart is allowed to trade.
To enable algo trading in MT5, click Algo Trading on the toolbar or press Ctrl+E. The MetaQuotes hotkey list describes Ctrl+E as "Allow/prohibit use of Expert Advisors", so pressing it again turns automated trading back off. Older builds and the MetaQuotes help call the same button AutoTrading, so any guide that says "enable auto trading in MT5" means this button.
After you click, open the Journal tab (Ctrl+T). The terminal logs a line saying automated trading is enabled. If the button switches itself off again after you change account, profile or chart, go to the section on automatic disable options.
If the button shows green and the EA still does not trade, check the EA's own permission next.
Is 'Allow Algo Trading' ticked in the EA's own settings? (error 4752)
Each EA attached to a chart has its own Allow Algo Trading permission, separate from the toolbar button. Both must be on. With this box unticked, the EA loads and runs but cannot send orders. (For the full install walkthrough, see how to add an Expert Advisor to MT5.)
The symptom is runtime error 4752, ERR_TRADE_DISABLED, "Trading by Expert Advisors prohibited", in the Experts tab (see the MQL5 runtime errors list). Unlike retcode 10027, this one points at a single EA, not the whole terminal.
To fix it:
1. Click the chart the EA is on.
2. Press F7 to open the EA's properties.
3. Open the Common tab.
4. Tick Allow Algo Trading.
5. Click OK.
You can also reach the same properties window by right-clicking the chart, opening Expert list and selecting the EA.
Why does it keep happening on new charts? The default for new attachments lives in Tools > Options > Expert Advisors > Allow algorithmic trading (shortcut: Ctrl+O). It applies to EAs you attach from now on and does not change EAs already on charts, so fix those with F7.
If the EA's documentation asks for DLL imports, open the Dependencies tab and tick Allow DLL imports. Enable this only for EAs from a source you trust, because a DLL runs code outside MT5's control.
If the EA has permission and trading still stops after you change account or chart, MT5 may be switching it off for you: see automatic disable options.
Did MT5 turn off algo trading when you switched account, profile or chart?
MT5 has three safety options in Tools > Options > Expert Advisors (Ctrl+O) that switch algo trading off when the trading account changes, when the profile changes, or when the chart's symbol or period changes. If MT5 algo trading turns off by itself right after a switch, one of these options is most likely the cause. A login with the investor password or a lost connection can look similar. In current builds the options read:
• Disable algorithmic trading when the account has been changed
• Disable algorithmic trading when the profile has been changed
• Disable algorithmic trading when the chart symbol or period has been changed
The wording differs slightly between builds, and older builds and the MetaQuotes help start them with "Disable automated trading when switching".
A typical case: you log into a second account, or flip the EA's chart from M15 to H1 to check something. The terminal turns Algo Trading off and the EA stops trading with no error of its own.
To get trading back, click Algo Trading (Ctrl+E) after each switch. If you change the EA's chart often, you can untick the chart-switch option instead. The EA then keeps trading on whatever symbol or timeframe you switch its chart to, so only do this if that is what you want. Keep the account-switch option ticked: it stops an EA built for one account from trading on another.
Give each EA its own chart and analyze on a separate one, so a timeframe change does not touch the EA.
Are you logged in with the investor password?
Every MT5 account has two passwords. The master password gives full trading access. The investor password is read-only: it lets you view the account but blocks every trade, whether the EA sends it or you place it by hand.
Charts and quotes update normally, but every order is rejected and the New Order window will not place a trade. In MQL5 terms, ACCOUNT_TRADE_ALLOWED ("Allowed trade for the current account") returns false, so no setting in the terminal or the EA can make it trade.
To log in again with the master password:
1. Open File > Login to Trade Account.
2. Enter your account number and the master password.
3. Select the correct server and click OK.
4. Check the Algo Trading button. If Disable algorithmic trading when the account has been changed is ticked in Tools > Options > Expert Advisors, the login switched algo trading off. Press Ctrl+E to turn it back on.
Can't find the master password? Reset it from your broker's client area, then log in again.
Is algo trading blocked on the server side? (retcode 10026)
Retcode 10026 (TRADE_RETCODE_SERVER_DISABLES_AT, "Autotrading disabled by server") means the broker's trade server does not allow Expert Advisors to trade on this account. Retcode 10027 comes from your own terminal; 10026 comes from the server, and no MT5 setting can override it. An EA that reads ACCOUNT_TRADE_EXPERT ("Allowed trade for an Expert Advisor") gets false on these accounts.
Brokers usually set this per account type, sometimes per account. Check your account's terms, or ask your broker which account types allow EAs, and run the EA on one of those.
On LHFX, Expert Advisors are allowed on Standard and Pro accounts, so a 10026 on an LHFX account is unlikely. If your EA still will not trade there, check whether you logged in with the investor password and whether the symbol can be traded right now (retcodes 10017, 10018, 10044).
Can the symbol be traded right now? (10017, 10044, 10018)
If MT5 shows 'Trade is disabled' on one symbol, or 'Market is closed' on a weekday, the server refused the order under that symbol's own rules, even with every permission switched on. The server checks those rules on each order, and three return codes point here:
Code | Constant | MetaQuotes description | What it usually means |
10017 | TRADE_RETCODE_TRADE_DISABLED | Trade is disabled | Trading on this symbol is switched off for your account |
10044 | TRADE_RETCODE_CLOSE_ONLY | The request is rejected, because the "Only position closing is allowed" rule is set for the symbol | You can close existing positions but not open new ones |
10018 | TRADE_RETCODE_MARKET_CLOSED | Market is closed | The order arrived outside the symbol's trading session |
Start with the symbol specification. Open Market Watch (Ctrl+M), right-click the symbol and choose Specification, and read the Trade field: full access, close only or disabled. The sessions table below it lists the hours the symbol can trade.
Next, check the symbol name. Different account types can use different symbol names or suffixes, for example EURUSD on one account and a suffixed version on another. An EA hard-coded to one name, or attached to a chart of a symbol your account cannot trade, will not open orders. Attach the EA to a chart of the symbol exactly as it appears in your Market Watch, or set the EA's symbol input to match that name.
Finally, check the calendar. An order sent outside the symbol's session, for example on a Saturday for FX pairs or on a market holiday, gets 10018. That is normal, and the EA can trade again once the session opens.
Is the EA actually running?
An EA that failed to load, or has stopped, sends no orders and often writes nothing new to the log. Start with the icon in the top-right corner of the chart, next to the EA's name:
What you see | What it means | Next step |
Blue cap (hat) icon | The EA is running and allowed to trade | Move on to the account and symbol checks |
Grey cap (hat) icon | The EA is loaded but blocked from trading | Turn on the Algo Trading button and Allow Algo Trading on the EA's Common tab |
No icon or EA name | The EA is not attached or failed to load | Read the Experts tab, then attach it again |
If there is no icon, or the EA stops soon after you attach it, read the Experts tab for load errors. Press Ctrl+T to open the Toolbox and select Experts. Look for a failed initialization, a missing DLL permission, missing indicator files or an EA compiled for an older build. For a compile problem, open the .mq5 source in MetaEditor and recompile it (F7 inside MetaEditor), or ask the developer for an updated .ex5 file.
To confirm what is attached, right-click the chart and choose Expert list. It shows every EA running in the terminal and the chart each one sits on.
Uptime matters too. An EA runs only while the MT5 desktop terminal is open, connected and logged in. A closed terminal, a PC that goes to sleep or a Windows update restart stops it. Running your MT5 EA on a VPS keeps the terminal open when your PC is off, but a VPS restart stops the EA the same way. The connection status sits in the bottom-right corner of the terminal. Retcode 10031, "No connection with the trade server", points to this cause.
Last, check the platform. EAs run in the MT5 desktop terminal on Windows and macOS. You can't install an EA on MT5 mobile: MT5 for iOS and Android and the web terminal at webtrader5.lhfx.com do not run EAs. Use them to monitor positions while the desktop terminal or your own VPS runs the EA. Download the MT5 desktop terminal if you only have the mobile or web version.
Did the EA decide not to trade, or send an order the server rejected?
If permissions, the account and the symbol all check out, the EA's own logic is the next suspect. Many EAs wait for conditions before they trade: session hours, a maximum spread, a maximum number of open positions, a news filter, a daily loss stop or a minimum free margin. Press F7 on the EA's chart, open the Inputs tab and compare each limit with the current market. A maximum spread input set below the symbol's current spread, for example, can keep the EA waiting with no error in the log.
If the EA does send an order, the Experts tab shows the server's reply. These four codes mean the server rejected the order as sent:
Code | MetaQuotes description | Usual cause | Fix |
10014 | Invalid volume in the request | Lot below the minimum, above the maximum or not a multiple of the volume step | Compare the EA's lot input with Market Watch > Specification |
10016 | Invalid stops in the request | Stop loss or take profit too close to the price | Widen the stop and target inputs |
10019 | There is not enough money to complete the request | Free margin too low for the lot size | Reduce the lot size or the number of positions |
10030 | Invalid order filling type | The EA hard-codes a filling mode the symbol does not support | Change the EA's filling-mode input, if it has one, or ask the developer |
If you see retcode 10030 (invalid fill), open Market Watch > Specification for the symbol and check the Filling field for the modes it supports, then set the EA's filling-mode input to one of them.
Magic numbers can also block new trades. A magic number is the ID an EA stamps on its own orders so it can find them later. Two EAs, or two copies of one EA, with the same magic number can treat each other's positions as their own and stop opening new ones. Give each chart a unique magic number in the EA inputs.
Duplicate copies cause the same problem. The same EA running on another terminal or a VPS on the same account can hit its max-positions limit or conflict with the copy you are watching. Open the Expert list on every terminal that logs into the account and remove the extra copy.
MT5 Expert Advisor not working? Quick checklist before you contact support
Run through these eight checks first.
1. The Algo Trading button is on (Ctrl+E).
2. Allow Algo Trading is ticked on the EA's Common tab (F7).
3. You logged in with the master password, not the investor password.
4. The symbol is tradable now (Specification > Trade, plus session times).
5. The cap icon next to the EA's name on the chart is blue, not grey.
6. The terminal is connected (bottom-right status bar).
7. EA inputs and lot size sit within the symbol's limits.
8. Only one copy of the EA is running.
Still failing? Send support your account number, EA name and version, chart symbol and timeframe, and the exact Experts and Journal lines with timestamps. Right-click in either tab to copy them or open the log file. Sending all of this in the first message cuts out a round of follow-up questions.
FAQ
What is the difference between retcode 10027 and error 4752 in MT5?
10027 (TRADE_RETCODE_CLIENT_DISABLES_AT, "Autotrading disabled by client terminal") means the terminal-wide Algo Trading button is off; fix it with Ctrl+E. 4752 (ERR_TRADE_DISABLED, "Trading by Expert Advisors prohibited") usually means this one EA is not permitted; tick Allow Algo Trading on its Common tab (F7).
Is MT4 error 4109 the same as the MT5 errors?
It is the MT4 equivalent. MQL4 error 4109 is ERR_TRADE_NOT_ALLOWED, "Trade is not allowed", and the MT4 docs point to the "Allow live trading" checkbox in the EA properties. In MT5 the same problem shows as 10027 or 4752, and the checkbox is called Allow Algo Trading. For other platform differences, see MT4 vs MT5.
What is algo trading in MT5?
Algo trading in MT5 means letting a program, usually an Expert Advisor written in MQL5, place and manage orders for you. The Algo Trading toolbar button and the EA's Allow Algo Trading setting decide whether those programs may trade. Both must be on.
Does an Expert Advisor need a VPS?
No, but it needs a terminal that stays open, connected and logged in. If your computer sleeps, restarts or loses its connection, the EA stops. Traders who want the EA running around the clock often use a VPS for that reason.
Can I run an Expert Advisor on the MT5 web terminal or MT5 for iOS and Android?
No. EAs run in the MT5 desktop terminal on Windows or macOS. The web terminal and MT5 for iOS and Android can show the positions your EA opens, so you can monitor trades on your phone while the desktop terminal or a VPS runs the EA.
Does LHFX allow Expert Advisors?
Yes. Expert Advisors, scalping and hedging are allowed on LHFX Standard and Pro accounts. LHFX runs on MetaTrader 5, available for Windows and macOS desktop, the web, and MT5 for iOS and Android. Download the desktop terminal from the MetaTrader 5 page to run your EA.


