How to Install an Expert Advisor in MT4 and MT5 (Step by Step)
How do you install an EA in MT4 or MT5?
To install an EA, open MetaTrader, choose File > Open Data Folder and copy the EA file into MQL4/Experts (MT4) or MQL5/Experts (MT5). Refresh the Navigator, compile the file in MetaEditor if it is source code, drag the EA onto a chart, allow live or algo trading, then switch on the AutoTrading or Algo Trading button.

An expert advisor (EA) is a program that trades or manages trades for you inside MetaTrader. If MetaTrader is new to you, start with how to use MT4 and MT5, and do your first install on a demo account, where a mistake costs nothing.
Which EA files do you need?
- Source code (.mq4 or .mq5): the readable instructions. MetaEditor, the code editor that comes with MetaTrader, compiles them: it translates them into a file the platform can run.
- Compiled files (.ex4 or .ex5): ready to run without compiling, but you cannot read what they do, so only use them from a source you trust.
- Include files (.mqh): shared code that the main file pulls in. They go in the Include folder, not Experts.

MT4 and MT5 files are not interchangeable. For readable source code, try the EA Library: each page lists the EA files it found and offers a “Download source (.zip)” button. Unzip it before you start.
How to install an EA in MT4
- Step 1, open the data folder: in MT4, choose File > Open Data Folder.
- Step 2, copy the files: open MQL4, then Experts, and paste the .mq4 or .ex4 file. Put any .mqh files in MQL4/Include, inside the same sub-folder the author used.
- Step 3, refresh: in the Navigator window (Ctrl+N), right-click Expert Advisors and choose Refresh, or restart MT4.
- Step 4, compile: if you copied an .mq4 file, press F4 to open MetaEditor, open the file and press F7. “0 errors” means an .ex4 file now sits next to the source.
- Step 5, attach it: drag the EA from the Navigator onto the chart of the pair and timeframe it was built for.
- Step 6, allow trading: in the window that opens, go to the Common tab and tick “Allow live trading”. Leave “Allow DLL imports” off unless the author explains why the EA needs it.
- Step 7, check the inputs: on the Inputs tab, set the lot size, stop-loss and other settings, then press OK.
- Step 8, switch on AutoTrading: click the AutoTrading button on the toolbar so its icon turns green.
Need MT4 code? Filter the library to MT4 expert advisors.
How to install an EA in MT5
- Step 1, open the data folder: choose File > Open Data Folder.
- Step 2, copy the files: open MQL5, then Experts, and paste the .mq5 or .ex5 file. Put .mqh files in MQL5/Include, in any sub-folder the code names.
- Step 3, refresh: right-click Expert Advisors in the Navigator and choose Refresh, or restart MT5.
- Step 4, compile: press F4 to open MetaEditor, open the .mq5 file and press F7. Fix any errors before you go on.
- Step 5, attach it: drag the EA onto a chart, or double-click it in the Navigator to attach it to the active chart.
- Step 6, allow trading: on the Common tab, tick “Allow Algo Trading”.
- Step 7, check the inputs: set the values on the Inputs tab and press OK.
- Step 8, switch on Algo Trading: click the Algo Trading button on the toolbar so it is on.
The library holds more MT5 expert advisors than MT4 ones.
How to tell if your EA is running
- The chart corner: the EA’s name appears in the top-right corner of the chart with a small icon. In MT4 it is a face that smiles when the EA may trade and frowns when it may not. In MT5 the icon is greyed out when algo trading is off.
- The Experts tab: open the Terminal (MT4) or Toolbox (MT5) window with Ctrl+T and click Experts. You should see a line saying the EA loaded, then any messages it prints.
- The Journal tab: the platform’s own log, where failed orders and connection problems show up.
An EA that runs but does not trade is often just waiting for its setup, which may take hours or days.
EA not showing in the Navigator or not working: fixes
- Not in the Navigator: the file is in the wrong folder, or in the data folder of a different MetaTrader installation. Check the path, then refresh or restart.
- Compile error naming an .mqh file: an include file is missing or in the wrong sub-folder. Copy the download’s Include files exactly as the author laid them out.
- Dozens of errors in MT5: you are probably compiling MQL4 code. The languages differ, so the EA must be rewritten or used on MT4.
- “Trade is disabled” or similar: you may be logged in with the investor (read-only) password, the symbol may be close-only, or your account type may not allow EAs. Check with your broker.
- Wrong symbol suffix: some brokers add letters to symbol names, such as EURUSD.m. An EA that looks for plain EURUSD finds nothing. Attach it to the exact chart, or change its symbol input.
- Market closed: at weekends and in daily breaks no new prices arrive, so the EA does nothing.
- Lot size below the minimum: if the EA asks for 0.001 lots and the broker’s minimum is 0.01, the order is rejected as an invalid volume. The minimum lot and lot step are in the symbol’s Specification, found by right-clicking it in Market Watch.
- AutoTrading off: the toolbar button is off, or “Allow live trading” or “Allow Algo Trading” is unticked for that EA. Reopen the EA’s properties from the chart’s right-click menu and check the Common tab.
- EA gone or off after changing account: logging in to another account or loading another profile can switch automated trading off (a setting under Tools > Options > Expert Advisors), and another profile may open charts without the EA. Re-attach it and switch the button back on. An EA can also remove itself if its own start-up checks fail; the Experts tab says why.
How to remove an EA
In MT4, right-click the chart and choose Expert Advisors > Remove. On MT5, or if you cannot find the option, close the chart: that removes the EA on either platform. Removing an EA does not close its open trades. They stay open with the stop-loss and take-profit they had, but any trailing stop or other management ends. To uninstall it, delete its files from the Experts folder and refresh the Navigator.
How to run several EAs at once
- One EA per chart: each chart holds only one EA. To run two, open two charts, even of the same pair.
- Different magic numbers: a magic number is an ID the EA stamps on its own trades so it never touches anyone else’s. Give every EA, and every copy of the same EA, its own number. EA settings explained covers this and the other common inputs.
- Check the MT5 account mode: on a netting account, trades in one symbol merge into a single position, so two EAs on EUR/USD will get in each other’s way. MT4 vs MT5 explains hedging and netting.
- Add up the risk: three EAs each risking 1% per trade can lose 3% at once if they all hit their stops together.
Test each one alone first; how to backtest an EA shows how.
Can you run an EA on the MetaTrader mobile app?
No. The MT4 and MT5 apps for iPhone and Android do not run expert advisors. An EA needs the desktop terminal running and connected, so it stops when your computer sleeps, restarts or goes offline. You can run the EA on a computer or on a virtual private server (VPS), a rented computer that stays online, and use the phone app to watch its trades. Running an EA 24/7 compares the options. When picking a broker for EAs, check that it allows automated trading; our broker comparison is a good start.
A correct installation only means the EA can place orders; it says nothing about whether those orders are good. Automated trading of forex and CFDs carries a high risk of loss, so test on a demo account first and only risk money you can afford to lose.
FAQ
Why is my EA grey in the MetaTrader Navigator?
A grey icon usually means MetaTrader found the file but has no working compiled version of it. Open the source file in MetaEditor and press F7 to compile. If the compiler lists errors, fix those first; a missing include file is a common cause. After a clean compile, refresh the Navigator and the EA should appear as normal.
Why can’t I find the MQL4 folder in Program Files?
Modern versions of MetaTrader usually keep EAs, indicators and settings in a separate data folder inside your Windows user profile, not in the program’s install folder. Each installed terminal has its own data folder with a long random-looking name. That is why File > Open Data Folder is the reliable route: it always opens the right place for the terminal you are using.
Is it safe to allow DLL imports for an EA?
A DLL is an outside Windows program file that an EA can call to do things MQL cannot, such as talk to other software. It can also do anything else a program on your computer can do. Allow DLL imports only for an EA whose source you have read, from an author you trust, and only when it clearly needs them.
How do I update an EA to a new version?
First save your current settings as a .set file from the Inputs tab. Then copy the new source files over the old ones in the Experts and Include folders, compile in MetaEditor and re-attach the EA to the chart. Keep the same magic number if you want it to manage trades it already opened. Test the new version on a demo account before going live.