Guides · · 4 min
How to Install an EA on MT4 (and Test It Before Going Live)
Copy the file, refresh, drag it onto a chart and switch on AutoTrading. A step-by-step EA install with fixes for when it won't trade.

To install an EA on MT4, open MetaTrader 4, go to File > Open Data Folder, copy the .ex4 or .mq4 file into MQL4 > Experts, refresh the Navigator, then drag the expert advisor onto a chart and switch on AutoTrading. The whole job takes about five minutes.
The short version
- EA files end in .ex4 (compiled) or .mq4 (source code).
- They go in the MQL4 > Experts folder inside MT4's data folder, not in Program Files.
- After copying, refresh the Navigator or restart MT4.
- Drag the EA onto a chart, allow live trading in its settings and turn AutoTrading on.
- Test it in the Strategy Tester and on a demo account before going live.
What you need before you install an expert advisor
- MetaTrader 4 installed from your broker, logged in to a demo or live account.
- The EA file. A .ex4 file is compiled and ready to run; a .mq4 file is source code that MT4 compiles when you refresh. Some vendors also supply .dll library files or .set preset files.
- A note of the settings the vendor recommends, such as lot size, symbols and timeframe.
If you have not chosen a robot yet, read do forex robots work? first. Most commercial EAs we reviewed did not justify their price.
How to install an EA on MT4, step by step
- Open the data folder. In MT4, click File > Open Data Folder. This opens the folder where your terminal keeps its files.
- Go to MQL4 > Experts. Open the MQL4 folder, then Experts.
- Copy the EA file in. Paste the .ex4 or .mq4 file here. If the vendor supplied .dll files, they go in MQL4 > Libraries; .set files go in MQL4 > Presets.
- Refresh MT4. Close the folder, then in the Navigator panel right-click Expert Advisors and choose Refresh, or restart the platform.
- Attach it to a chart. Open a chart of the symbol and timeframe the EA is designed for, then drag the EA from the Navigator onto it.
- Set the options. In the window that opens, the Common tab has "Allow live trading" (needed for the EA to place orders) and "Allow DLL imports" (only if the EA needs it). The Inputs tab holds the strategy settings; you can load a .set file here.
- Turn on AutoTrading. Click the AutoTrading button on the toolbar. A smiling face in the top-right corner of the chart means the EA is running.
CMC Markets publishes a similar walkthrough in its guide to installing an expert advisor on MT4, with screenshots of each window.
Why is my EA not trading?
| What you see | Likely cause | Fix |
|---|---|---|
| EA not in the Navigator | Wrong folder, or MT4 not refreshed | Check it is in MQL4 > Experts of this terminal's data folder, then refresh |
| Sad face on the chart | Live trading not allowed | Press F7 and tick "Allow live trading" |
| No face at all | AutoTrading off | Click AutoTrading on the toolbar |
| "DLL calls are not allowed" in the Experts tab | DLL imports blocked | Tick "Allow DLL imports" if you trust the EA |
| Error 130 or 131 in the Journal | Invalid stops or lot size for your broker | Adjust stop distance or lot size to your broker's limits |
The Experts and Journal tabs at the bottom of the terminal show what the EA is doing and any errors. Read them before assuming the robot is broken.
How to test an EA in the MT4 Strategy Tester
Open View > Strategy Tester (Ctrl+R), choose the EA, symbol, timeframe and date range, and press Start. The Results, Graph and Report tabs show every trade and the equity curve. Use the "Every tick" model for the most realistic test, and set a spread close to what your broker actually charges.
A backtest only shows how the rules would have performed in the past. Treat a perfect, straight-line curve as a warning sign of over-optimisation, not proof the EA works. Our forex robot reviews show how often backtests and live results disagree.
Keeping an EA running
An EA only trades while MT4 is open and connected. If your computer sleeps, the robot stops. Many traders run MT4 on a virtual private server close to their broker's servers; see our overview of forex trading via VPS. Check the terminal after weekends and platform updates, since a restart can switch AutoTrading off.
Before you start
Run a new EA on a demo account for several weeks, then on a small live account. Know the maximum loss you are willing to take and switch the EA off if it is hit. Leveraged trading can lose money quickly.
FAQ
Where are expert advisors stored in MT4?
In the MQL4 > Experts folder of the terminal's data folder. Open it from MT4 with File > Open Data Folder rather than searching Program Files.
Can I install an MT5 EA on MT4?
No. MT5 expert advisors use .ex5 and .mq5 files written in MQL5, which MT4 cannot run. You need a version built for MT4.
Can I run more than one EA at the same time?
Yes, but only one EA per chart. Open a separate chart for each EA, and make sure they use different magic numbers so they do not manage each other's trades.
Does an EA keep trading when I close MT4?
No. The platform must stay open and connected. That is why many people run MT4 on a VPS that stays online all the time.