An Expert Advisor (EA) is a program that runs inside MetaTrader 5 and can open, manage and close trades by its own rules. Installing one takes minutes, but small details decide whether it actually trades. This guide walks through both installation routes, the MQL5 Market and a downloaded .ex5 file, then covers the settings to check and the most common errors on XAUUSD.
Before you start: what you need
- The MetaTrader 5 desktop terminal on Windows (or a Windows VPS). EAs do not run on the MT5 mobile apps or in the web terminal.
- A trading account logged in, ideally a demo account first. Every EA should be tested on demo before it touches real money.
- The EA file: an
.ex5file (compiled, ready to run) or an.mq5file (source code that must be compiled first). A product bought on the MQL5 Market installs itself and you never handle a file.
MT4 EAs (.ex4/.mq4) do not run in MT5.
Method 1: install an EA from the MQL5 Market
- In MT5, open Tools → Options → Community and log in with your MQL5.com account. Purchases are tied to this account.
- Open the Market tab in the Toolbox (or buy on the MQL5 website while logged in to the same account).
- Find the product and click Buy, Rent or Free Demo. MT5 downloads and installs it automatically.
- Open the Navigator (Ctrl+N). The EA appears under Expert Advisors → Market.
Each Market purchase comes with a limited number of activations set by the seller. An activation is used each time the product is installed on a new computer or after major hardware or Windows changes, so install it on the machine or VPS where it will actually run. The free demo version only works in the Strategy Tester, which is the right place to try it first - see how to backtest an EA in the MT5 Strategy Tester.
Method 2: install an .ex5 or .mq5 file manually
- In MT5 click File → Open Data Folder. Do not search Program Files: MT5 keeps your files in a separate data folder, and copying into the wrong place is the most common reason an EA "does not show up".
- Open MQL5 → Experts and paste the
.ex5file there. If the seller included a library or include file, put it in MQL5 → Libraries or MQL5 → Include as instructed. - Back in MT5, right-click Expert Advisors in the Navigator and choose Refresh, or restart the terminal.
- For an
.mq5source file: double-click it in the Navigator to open MetaEditor, press F7 (Compile) and check that the log shows 0 errors. MetaEditor creates the.ex5next to it.
Attach the EA to a chart
- Open the chart the EA was designed for, for example XAUUSD on the timeframe stated in its manual. An EA reads the chart it sits on, so the wrong timeframe changes its behaviour.
- Drag the EA from the Navigator onto the chart, or double-click it.
- On the Common tab, tick Allow Algo Trading. Only tick "Allow DLL imports" if the documentation says it is needed and you trust the source.
- On the Inputs tab, set risk, lot mode, magic number and any filters, then click OK.
- Make sure the Algo Trading button on the main toolbar is green. In older builds it was called AutoTrading.
When it is running, the EA name shows in the top-right corner of the chart with an active (blue) icon. A grey icon means algorithmic trading is disabled somewhere: on the toolbar, in the EA's Common tab, or in Tools → Options → Expert Advisors.
Check the settings before going live
Most EAs size positions either with a fixed lot or with a risk percentage of the balance. On gold the dollar value of a move is large, so check what the inputs mean in money terms. On a standard XAUUSD contract of 100 ounces per lot, a 1-dollar move is worth 100 USD per 1.00 lot, or 1 USD per 0.01 lot.
| Balance | Risk input | Money at risk | EA stop distance | Lot the EA should use |
|---|---|---|---|---|
| 1,000 USD | 1% | 10 USD | $10 | 0.01 |
| 1,000 USD | 1% | 10 USD | $20 | 0.005 → below 0.01, trade should be skipped |
| 5,000 USD | 1% | 50 USD | $12.50 | 0.04 |
| 10,000 USD | 0.5% | 50 USD | $10 | 0.05 |
Contract sizes, minimum lots and lot steps differ between brokers and account types. Right-click the symbol in Market Watch, choose Specification, and compare contract size, volume min and volume step with what the EA expects. If the 1% sizing problem on small accounts is new to you, read the 1% risk rule with gold examples.
Common errors and what they mean
Open the Toolbox (Ctrl+T) and read the Experts and Journal tabs. Almost every problem leaves a message there.
| Message or symptom | Likely cause | Fix |
|---|---|---|
| "algo trading is disabled" | Toolbar button off or Common tab unticked | Turn on Algo Trading and re-open the EA properties |
| EA not in the Navigator | File copied to the wrong folder, or it is an MT4 file | Use File → Open Data Folder → MQL5 → Experts, then Refresh |
| "invalid volume" | Lot below the minimum or not a multiple of the lot step | Check the symbol specification and the EA's lot inputs |
| "not enough money" | Free margin too low for the lot | Lower risk or lot size; check leverage |
| "invalid stops" | Stop or target closer than the broker's stops level | Wider stop, or a broker with a lower stops level |
| "market closed" | Weekend, holiday or daily break on gold | Nothing to fix; check the session times |
| No trades, no errors | Symbol suffix (XAUUSDm, XAUUSD.r), wrong timeframe, or entry conditions simply not met | Attach to the broker's exact gold symbol and the documented timeframe; wait |
"No trades yet" is often normal. A breakout EA such as the London Breakout EA may trade once a day or not at all on a quiet day, and a trend system like the Turtle Channel EA can wait days for a valid setup.
Keep it running
An EA only works while the terminal is open and connected. If you close MT5, shut down the computer or lose internet, it stops managing positions, including trailing stops and time exits; only stop loss and take profit orders already sent to the broker stay in place. That is why many traders run EAs on a VPS near their broker's server (see do you need a VPS for an MT5 EA for the cost and latency math). After any restart, check the chart corner icon and the Journal tab to confirm the EA reloaded.
Looking for an EA to practise this with? The GoldLab XAUUSD EA list groups each system by strategy, and every one uses a stop loss on every trade with risk-percent sizing.
Key takeaways
- Market products install automatically; files go in File → Open Data Folder → MQL5 → Experts.
- The EA trades only when Algo Trading is on in the toolbar and "Allow Algo Trading" is ticked for that chart.
- On XAUUSD, 1.00 lot = 100 USD per 1-dollar move on a 100-ounce contract; check the EA's lot output on demo first.
- The Experts and Journal tabs explain almost every "EA not trading" problem.
FAQ
Where do I put an EA file in MT5?
Click File → Open Data Folder in MT5, then open MQL5 → Experts and paste the .ex5 file there. Refresh the Navigator or restart MT5 and it appears under Expert Advisors.
Can I install an MT4 EA in MT5?
No. MT4 files (.ex4 and .mq4) do not run in MT5. You need a version written for MT5, or the source code rewritten in MQL5.
Why is my EA attached but not trading?
Check that the Algo Trading button is green, that Allow Algo Trading is ticked in the EA properties, and read the Experts tab. Wrong symbol suffix, wrong timeframe, too small a lot or simply no valid setup are the usual causes. The full step-by-step check is in MT5 EA not trading: causes and fixes.
Can I run an EA on the MT5 mobile app?
No. The mobile apps can show trades opened by an EA, but the EA itself must run in the desktop terminal or on a VPS.
Do I need a VPS for an EA?
Not to install it, but an EA stops when your computer sleeps or disconnects, so a VPS is the usual choice for running it around the clock during the trading week.
For education only, not investment advice. Trading gold and CFDs is high risk and you can lose your capital.