To install an Expert Advisor in MT5, copy the EA file (.ex5) into the MQL5/Experts folder via File → Open Data Folder, refresh the Navigator, drag the EA onto a chart, tick "Allow Algo Trading", and switch on the Algo Trading button in the toolbar. Most problems after that come from a handful of settings: inputs, symbol names, WebRequest permissions, magic numbers and account type.
What you need before installing an EA
Check these before you start:
- The MetaTrader 5 desktop terminal on Windows (or a Windows VPS). EAs do not run in the mobile apps or the web terminal.
- The EA file. A compiled EA ends in .ex5. A source file ends in .mq5 and must be compiled in MetaEditor first.
- An account you can log in to, ideally a demo account for the first run.
- The vendor's settings notes: recommended inputs, symbol, timeframe and any URLs the EA needs to reach.
Test every new EA on a demo account first.
Step-by-step: install an EA in MT5
- Open the data folder. In MT5, go to File → Open Data Folder. A file explorer window opens.
- Copy the file. Open MQL5 → Experts and paste the .ex5 file there. You can create a subfolder to keep things tidy.
- Refresh the Navigator. Back in MT5, open the Navigator (Ctrl+N), right-click Expert Advisors and choose Refresh. You can also restart the terminal.
- Open the right chart. Open the symbol and timeframe the EA is designed for, for example XAUUSD M15.
- Attach the EA. Drag it from the Navigator onto the chart, or double-click it.
- Allow algo trading. In the window that opens, on the Common tab, tick Allow Algo Trading. Enable DLL imports only if the vendor requires them and you trust the source.
- Set the inputs. Go to the Inputs tab and set risk, magic number and other parameters (see below). Click OK.
- Turn on Algo Trading. Click the Algo Trading button in the main toolbar so it turns green. Older builds call this button AutoTrading.
- Confirm it is running. An EA icon appears in the top-right corner of the chart. Check the Experts tab in the Toolbox (Ctrl+T) for a message that the EA loaded successfully.
If the EA loads but the corner icon looks disabled, algo trading is off either for the terminal or for that EA.
Setting EA inputs correctly
Inputs are where most costly mistakes happen. Read each one and check:
- Risk mode. Is it a percentage of balance, a fixed dollar amount or a fixed lot size? On gold, 1 standard lot = 100 oz, so a $1 move is $100 per lot and $1 per 0.01 lot. A fixed lot on a wide-stop trade can risk far more than you intended.
- Symbol name. Brokers name gold differently: XAUUSD, XAUUSD.m, GOLD and so on. Some EAs need the exact name typed in.
- Trading hours or time offsets. Many EAs use broker server time, which may differ from your local time.
- Optional features. For example, the Pulse EA has an optional Free Add input that places one extra position once a trade is at breakeven. Leave optional features off until you understand what they do; our pyramiding guide explains the logic behind that one.
Save a known-good configuration with Save on the Inputs tab, so you can reload it later.
Allowing WebRequest URLs
Some EAs need to reach the internet: to check a licence, read news times or send notifications. MT5 blocks this by default.
- Go to Tools → Options → Expert Advisors.
- Tick Allow WebRequest for listed URL.
- Add each URL the vendor lists, exactly as given.
- Click OK and re-attach the EA if needed.
Only add URLs from a vendor you trust.
Magic numbers: running more than one EA
A magic number is an ID the EA stamps on its orders so it can recognise its own trades. If two EAs, or two copies of one EA on different charts, share a magic number on the same symbol, they may manage or close each other's positions.
Give each EA instance a unique magic number. Write them down in a simple list: chart, EA, magic number, settings file.
Hedging vs netting accounts
MT5 accounts come in two position modes, chosen when the account is opened:
| Mode | How positions work | What it means for EAs |
|---|---|---|
| Hedging | Multiple positions per symbol, including buys and sells at once | Most retail EAs expect this |
| Netting | One net position per symbol; new orders add to or reduce it | EAs that open separate positions may behave incorrectly |
If an EA adds a second position, as a pyramiding feature does, a netting account will merge it into one position. Check which mode your account uses before going live; your broker can confirm it.
Common MT5 EA errors and how to fix them
Read the Experts and Journal tabs first. The message usually tells you what went wrong.
- "Algo trading is disabled" / "AutoTrading disabled by client". Turn on the toolbar button and tick Allow Algo Trading in the EA's Common tab.
- Invalid stops (10016). The stop loss or take profit is too close to price for the broker's minimum distance, or on the wrong side of price.
- Invalid volume (10014). The lot size is below the minimum, above the maximum, or not a valid step. Check the symbol's specification.
- Not enough money (10019). Margin is insufficient for the order. Reduce size or check leverage.
- Market closed (10018). The EA tried to trade outside the symbol's trading session, often near the daily rollover or at the weekend.
- EA does not appear in the Navigator. The file is in the wrong folder, or you copied it into a different terminal's data folder. Use File → Open Data Folder from the terminal you are running.
- EA stops when you close your laptop. The terminal must stay running. This is why many traders use a VPS; see do you need a forex VPS.
After installation: test before you trust
Installing an EA is the easy part. Before risking money:
- Run it in the Strategy Tester with realistic settings. Our guide on how to backtest an EA in MT5 covers tick models, spread and out-of-sample testing.
- Run it on a demo account for a few weeks and compare the trades with what the vendor shows.
- Start live with small risk and scale only once behaviour matches your expectations.
If you are still choosing between running an EA yourself, following signals or copying trades, see copy trading vs signals vs EA.
FAQ
Where do I put an EA file in MT5?
Open MT5, go to File → Open Data Folder, then MQL5 → Experts, and paste the .ex5 file there. Refresh the Navigator or restart the terminal. The EA then appears under Expert Advisors.
Why is my EA not taking trades in MT5?
The most common causes are Algo Trading being off, the wrong symbol name, trading hours set in the wrong time zone, or no valid setup yet. Check the Experts and Journal tabs for error messages. A selective EA may go days without a trade.
Can I run an MT5 EA on a Mac or phone?
EAs cannot run in the MT5 mobile apps. On a Mac you need a way to run the Windows terminal, or you can host MT5 on a Windows VPS and monitor it from any device.
Do I need a different magic number for each EA?
Yes. Each EA instance should have a unique magic number so it only manages its own trades. Sharing a magic number on the same symbol can cause one EA to close or modify another's positions.
This article is educational and not financial advice. Trading gold and leveraged products carries a high risk of loss.
Trade the tested model
Live XAUUSD signals, an MT5 indicator and a fully automated MT5 EA, all from one tested rule set.
Trading involves substantial risk. This is educational content, not financial advice. See the risk disclosure.