How to use Expert Advisors (EAs) in MT4 & MT5
An Expert Advisor is a program that trades a MetaTrader account for you, following rules someone has written in code. This is the plain-English version: what an EA actually does, how to install one, how to switch it on safely, and how to configure its settings — the bit most people get stuck on.
What is an Expert Advisor?
An Expert Advisor (EA) is an automated trading program that runs inside MetaTrader 4 or 5. It watches the market according to rules written in code (the MQL language), and when those rules are met it can open, manage and close trades on your account — without you clicking anything. People also call them trading robots or bots.
An EA can do as little as move a stop-loss for you, or as much as run an entire strategy 24 hours a day. What it can't do is guarantee a profit — an EA only ever executes the rules it was given, well or badly.
How an EA works
Every time the price moves, MetaTrader hands the new price to the EA. The EA runs its rules, decides whether to do anything, and — if a rule fires — sends an order to your broker. Then it waits for the next price tick and does it all again.
Installing an EA
An EA file ends in .ex4 (MT4) or .ex5 (MT5) — the compiled program — and
sometimes comes with a .mq4/.mq5 source file. To install it:
- In MetaTrader, open File → Open Data Folder. This opens the exact folder MetaTrader reads from.
- Go into MQL4 → Experts (or MQL5 → Experts on MT5) and copy the EA file in there.
- Back in MetaTrader, right-click Navigator → Refresh. The EA now appears under "Expert Advisors".
- Drag the EA from the Navigator onto a chart of the symbol and timeframe you want it to run on. A settings window opens.
Turning it on: AutoTrading
Installing an EA does not let it trade yet. Two switches have to be on:
- In the EA's settings window, on the Common tab, tick "Allow live trading" (older builds: "Allow Automated Trading").
- On the main toolbar, click the AutoTrading button so it is green. If it is red, the EA will not place trades.
When it's working you'll see a small smiley face 🙂 in the top-right corner of the chart. A sad face ☹ or an ✕ means something is off — usually AutoTrading is disabled.
Configuring the inputs
This is where most people get stuck. The Inputs tab of the settings window is a list of the EA's adjustable settings — the "dials" the developer exposed. Double-click a value to change it. Common inputs include:
- Lots — the trade size. The single biggest driver of your risk. Start small.
- StopLoss / TakeProfit — where the EA exits for a loss or a profit, usually in pips.
- MaxSpread — the EA skips trades if the spread is wider than this. A genuine cost control — set it sensibly for your broker.
- TradingHours / time filter — restricts trading to certain sessions.
- MagicNumber — an ID the EA stamps on its own trades so it doesn't touch others. Give each EA a different one.
MaxSpread avoids expensive fills; a bigger Lots
multiplies every cost. See what a given size really costs on the cost tool.Common mistakes
- AutoTrading is off — the red button, or an ✕ on the chart. Nothing will trade.
- "Allow live trading" unticked — re-open the EA settings (drag it on again or right-click chart → Expert Advisors → Properties) and tick it.
- Wrong chart or timeframe — an EA only runs on the one chart it's attached to. Put it on the symbol/timeframe it was designed for.
- "DLL imports" needed — some EAs need this ticked on the Common tab. Only enable it for an EA you trust.
- Computer asleep = EA stops. An EA only runs while MetaTrader is open and online. For 24/5 trading, run it on a VPS so it never sleeps.
- Skipping the backtest — use the Strategy Tester (Ctrl+R) to run the EA on history first, and include realistic spread/commission so the result isn't fantasy.
MT4 vs MT5: what changes
- EAs are written in MQL4 for MT4 and MQL5 for MT5 — they are not
interchangeable. An
.ex4won't run on MT5, and vice-versa. - The folders differ (
MQL4/ExpertsvsMQL5/Experts), but the drag-onto-chart and AutoTrading steps are the same. - MT5's Strategy Tester is faster and supports multi-symbol testing; the account model differs (netting vs hedging), which can change how an EA manages positions.
Running an EA? Know what it really costs.
EAs trade often, so cost is frequently the difference between a winning and a losing system. Upload your statement and see your true cost per trade, plotted across the month, and which broker would run your EA cheapest.
Audit my statement →This guide is general educational information about how MetaTrader works. It is not trading advice, not a recommendation of any EA or strategy, and not a promise of any outcome. Trading CFDs is high-risk and most retail investor accounts lose money.