You just spent a few hundred bucks on an EA, or got a .ex5 file from a friend. I opened MT5 and rummaged through the menu, but I couldn’t find where to install it. I dragged the file into the MT5 window, but nothing happened. Copied it to the installation directory, but still no response.
Almost every novice has stepped on this pit. The data folder and installation directory of MT5 are separate. If you directly drop the EA under C:\Program Files\MetaTrader 5, MT5 will not look there at all.
This tutorial starts from finding the right folder and goes all the way to running the EA on the chart. Each step is marked with a picture, so just follow it.
First figure out the two files: .mq5 and .ex5
Before taking action, first identify what document you have in your hand.
.ex5 file is a compiled finished product that can be run directly by MT5. Most of the EAs you buy and download from others are in this format. You can use it as soon as you get it, no additional operations are required.
.mq5 file is source code, which is equivalent to a "design drawing". MT5 cannot run it directly, you need to use MetaEditor to compile it into .ex5 first. If you only got .mq5, don’t panic, I will teach you how to compile it later.
There are several other files that may appear together:
.mqh: Header file, which is the "part" that the EA code depends on, is placed in theIncludefolder.dll: Dynamic link library, some EAs need to call external functions, put it in theLibrariesfolder.set: Parameter preset file, helping you load the parameter configuration recommended by the author with one click
If you downloaded a compressed package, unzip it first and see what file types are inside to get an idea.
Step one: Find the MT5 data folder
This step is the easiest to get wrong.
MT5 has two directories: one is the installation directory(usually in C:\Program Files\MetaTrader 5), and the other is the data folder(hidden deep in the system user directory). The EA file must be placed in the data folder, it is useless to put it in the installation directory. The easiest way to open the data folder:
- Open MT5
- Click on the top menu File 3. Select Open Data Folder An explorer window will pop up, and the path may look like this:
C:\Users\YourUsername\AppData\Roaming\MetaQuotes\Terminal\D0E8209F77C8CF37AD8BF550E51FF075\
The string of garbled characters in the middle is the unique identifier generated by MT5 based on the installation path. Each computer is different, so don’t worry about it.
After entering this folder, you will see a MQL5 subfolder, this is where you want to work. Open it, the directory structure inside is like this:
MQL5/
├── Experts/ ← Place EA files here
├── Indicators/ ← Place custom indicators here
├── Scripts/ ← Place scripts here
├── Include/ ← Place .mqh header files here
├── Libraries/ ← Place .dll libraries here
├── Files/ ← Sandbox folder for EA runtime read/write
└── Presets/ ← Place .set preset files here
Note: If you have multiple MT5 installed (for example, if you open two broker's terminals at the same time), each terminal will have its own independent data folder. Be sure to click "Open Data Folder" from the MT5 where you want to install the EA, don't get confused.
Step 2: Copy the file to the correct location
Now that you know where the data folder is, the next step is to put the files in the right place.
Most common case: only one .ex5 file
Directly copy the .ex5 file to the MQL5\Experts\ folder. That's it, done.
You can create subfolders in Experts for classification management, such as Experts\TrendStrategies\, Experts\GridStrategies\, which can be recognized by MT5.
EA comes with .dll file
Some EAs need to call external DLLs to implement special functions (such as encryption verification, complex calculations). The DLL file must be placed under the MQL5\Libraries\ folder, not next to the EA.
This is a high-frequency error: many people put .dll and .ex5 together, and as a result, the EA starts with a "Cannot load DLL" error.
EA comes with .mqh file
If there is a .mqh file in the compressed package, put it in the MQL5\Include\ folder. These files are usually only needed when compiling the .mq5 source code. If you get .ex5 directly, you generally don’t need to worry about .mqh.
EA comes with .set file
The .set file is a parameter preset and is placed in the MQL5\Presets\ folder. These parameters can be loaded with one click when mounting the EA later.
File Placement Cheat Sheet
| File type | Where to put | Description |
|---|---|---|
.ex5 | MQL5\Experts\ | EA executable file |
.mq5 | MQL5\Experts\ | EA source code (needs to be compiled) |
.dll | MQL5\Libraries\ | Dynamic link library |
.mqh | MQL5\Include\ | Header files/code dependencies |
.set | MQL5\Presets\ | Parameter preset |
Step 3: Refresh the Navigator in MT5
After placing the file, return to the MT5 interface.
Press Ctrl+N to open the Navigator panel (don't press it if it's already open). Find the "Expert Advisors" item in the navigator, right-click it and select "Refresh".
After refreshing, the EA you just put in should appear in the list. If not:
- Check whether the file is placed in the correct location (click "Open Data Folder" again from MT5 to confirm)
- Check whether the file is in
.ex5format (.mq5needs to be compiled first) - If it still doesn’t work, close MT5 and reopen it
Step 4: Hang the EA on the chart
After finding the EA, you need to "mount" it on a chart to run it.
Operation method: Find your EA in the navigator and double-click it directly, or use the mouse to drag and drag it to the chart window.
A settings dialog box will pop up with several tabs in it. Don't rush to make sure, let's look at them one by one.
"Common" tab
This page has several key check options:- Allow Algo Trading: Must be checked. If you don't check it, EA can run, but it won't place an order.
- Allow DLL Imports: If the EA comes with a
.dllfile, you need to check it. Only turn this option on for EAs you trust as the DLL has full system access - Allow modification of Signals settings: Most EAs will not use it, just keep the default
"Inputs" tab
This page lists all the adjustable parameters of the EA. For example, lot size, stop loss points, take profit multiple, trading type filtering, etc.
- Click the "Value" column of a row to modify parameters
- There is a "Load" button at the bottom, which can import the
.setpreset file mentioned before - "Save" button can save the current parameters as a
.setfile for easy reuse in the future. - "Reset" will restore to the default values set by the author
If you are not sure how to fill in the parameters, run with the default values first. Most EA authors will adjust the default parameters to a relatively stable state.
After checking both tabs, click OK.
Step 5: Turn on automatic trading
The EA is up, but it cannot trade yet. MT5 has three levels of permission switches, and all EAs must be opened before you can actually place an order.
First level: Toolbar master switch
Look there is a "Algo Trading" button on the MT5 toolbar. Click it so the icon turns green.
- Green = Autotrading is allowed globally
- red/gray = global ban
This is the highest level switch. Even if you check "Allow algorithmic trading" in the EA settings, if this button is not turned on, all EAs will be silent.
Second level: global platform settings
Click the menu Tools→ Options and switch to the "Expert Advisors" tab. Make sure "Allow Algo Trading" is checked.
There are also several optional safety switches:
- "Disable automatic trading when switching accounts" - prevents the EA from automatically placing orders on a real account when you switch to a demo account
- "Disable automatic trading when switching charts" - to prevent accidentally triggering transactions
- "Disable automatic trading when switching configurations"
It is recommended to keep these safety switches as default (checked). They occasionally make you wonder "why the EA suddenly stopped trading", but they do protect you in critical moments.
Third level: Permissions of a single EA
As mentioned in the fourth step, check the "Algorithmic Trading" option on the "General" tab in the EA mounting dialog box.
All three levels of permissions must be enabled before EA can place orders. If any layer is closed, EA will just wait and see but not take action.
How to judge whether the EA is running normally
After the EA is successfully mounted and obtains trading permissions, you will see the EA's name and a small icon in the upper right corner of the chart.
- See a smiley icon next to the EA name: everything is normal, the EA is running and has permission to trade
- If you see a gray icon or no smiley face: the EA is running but does not have trading permissions, check the three-layer switches above
- Nothing in the upper right corner of the chart: EA was not successfully mounted, drag it again
In addition, open the bottom toolbox (press Ctrl+T) and switch to the "EA Trading" (Experts) tab. All log information output by the EA will be displayed here. If the EA is started successfully, usually an initialization message line is printed. If something goes wrong, error messages will also appear here.
If you get the .mq5 source code: how to compile it
Some EAs are distributed in source code form and you need to compile them yourself. It is not difficult to operate.1. Press F4 in MT5 to open MetaEditor (the code editor that comes with MT5)
2. In MetaEditor, press Ctrl+O to open the file and find your .mq5 file. Or, if you have put .mq5 in the MQL5\Experts\ directory, find it directly in the file tree on the left and double-click to open it.
3. Press F7 to compile
See the "Errors" panel at the bottom for the compilation results:
- 0 errors, 0 warnings: Compilation successful,
.ex5file has been automatically generated in the same directory - with errors: Compilation failed and code errors need to be fixed. Double-click the error message to jump to the problematic line of code. Common cause is missing
.mqhheader files - put them in theMQL5\Include\directory and try again - Only warnings but no errors: The compilation was successful, but there were some warnings that did not affect the operation.
After the compilation is completed, return to MT5, refresh the navigator, and the EA will appear.
Another installation method: buy directly from MQL5 Market
If you don't want to mess around with files, MT5 has a built-in application store - MQL5 Market, where you can browse, purchase and install EAs directly.
- Open the MT5 Navigator panel (Ctrl+N)
- Expand the "Market" node at the bottom
- Browse or search for the EA you want
- Click EA to view description, screenshots, user reviews and backtest results
- Click "Download"(free EA) or "Purchase"(paid EA)
- You need to associate an MQL5.com account before purchasing: Tools→ Options→ MQL5.community tab, fill in your account password
EAs purchased from the Market are automatically installed to the correct location, no manual copying of files is required. After purchase, it can be managed in Market→ Purchased. The EA purchased in the market is bound to your MQL5 account and hardware device, and has a limit on the number of activations (usually 5-10 times). Changing computers or reinstalling the system will consume activation times.
Troubleshooting common problems
EA has been put in but cannot be seen in the navigator
| Possible causes | Solutions |
|---|---|
| The file is in the wrong location | From MT5, click "File → Open Data Folder" to confirm the path, and put the EA under MQL5\Experts\ |
Only .mq5 but not .ex5 | Compile with MetaEditor (press F4 to open the editor, F7 to compile) |
| Compilation failed | Check the error panel at the bottom of MetaEditor, missing .mqh files is the most common reason |
| Multiple MT5 terminals mixed up | Make sure to click "Open Data Folder" from within the target terminal, the data directory is different for each terminal |
| The navigator is not refreshed | Right-click "EA Trading" → Refresh, or restart MT5 |
EA is up but not trading
Ninety percent of the time it's a permissions issue. Check in this order:
- Is the "Algorithmic Trading" button on the toolbar green?
- Tools → Options → Expert Advisor → "Allow algorithmic trading" is checked?
- EA Properties → General → "Allow algorithmic trading" is checked?
- Is there a smiley icon next to the EA's name in the upper right corner of the chart?
If all three levels of permissions are enabled and still no trading occurs, open the "EA Trading" tab in the bottom toolbox to view the logs. The EA may be waiting for specific entry conditions, or the current market is not within its trading session.
"Cannot load DLL" error
The DLL file was placed in the wrong location. The correct location is MQL5\Libraries\, not MQL5\Experts\. Also make sure "Allow DLL import" is checked in the EA settings.
Can multiple EAs be attached to one chart?
No. MT5 strictly limits running one EA per chart. If you want to run multiple EAs at the same time, you need to open multiple chart windows, one for each chart. To run the same EA but with different parameters (such as different varieties, different lot sizes) at the same time, set a different Magic Number(in the EA parameters) for each instance, so that the orders of each instance will not interfere with each other.
What will happen if the parameters are modified after running the EA?
Right-click on the chart → EA Trading→ Properties(or press F7) to open the parameter panel for modification at any time. Most EAs will automatically reinitialize after parameter changes. Open positions are usually not affected, but the specific behavior depends on the design of the EA. It is recommended to test the effect of parameter changes on a demo account first.
Frequently Asked Questions (FAQ)
Q: Do I have to keep MT5 open after installing EA? Yes. The EA runs in the MT5 process, and the EA stops when MT5 is closed. This is why many people rent a VPS to run MT5 around the clock - you can't turn off your computer 24 hours a day. If you need a tutorial on VPS deployment, you can read our "Complete Tutorial on Running EA on VPS Offline".
Q: Does EA support both MT4 and MT5? Not universal. The EA format of MT4 is .ex4 (or .mq4 source code), and that of MT5 is .ex5 (or .mq5 source code). Although the two programming languages are both named MQL, their syntax is very different and cannot be loaded into each other. Before buying an EA, be sure to read clearly the applicable platforms marked.
Q: Is there any difference between the installation methods of free EA and paid EA? The installation method is exactly the same. Whether you buy it for a few thousand yuan or download it for free, as long as you get the .ex5 file, the installation process is the steps mentioned above. The only difference is that some paid EAs have an authorization verification mechanism, and you may need to enter an authorization code or bind an account when you run it for the first time after installation.
Q: I am using the Portable Mode MT5. Is the installation method the same? Basically the same. The difference with the portable version is that the data folder is the MT5 installation directory itself (rather than hidden in AppData). The location you open from "File → Open Data Folder" is the folder where you installed MT5. Just put the file directly in MQL5\Experts\ inside. Q: Can EA files be placed in the subfolder of Experts? Can. MT5 will recursively scan all subfolders below Experts. You can create folders for classification management by policy type or source, and the same tree structure will be displayed in the navigator.
Summary
Installing an EA actually requires three things: Place the file in the right location, hang it on the chart, and open trading permissions.
The first operation may cause you to get stuck at the "find data folder" step, but once you figure it out, it won't take more than two minutes to install any EA in the future.
Don’t rush to open a real account after installing it. Run it on a demo account for a few days first to make sure that the EA is running normally, the parameters are reasonable, and you can understand what it is doing, and then consider the real deal.