Home › Guides › Automation › Installing an EA
Installing an EA in MetaTrader 5 step by step
Installing an expert advisor is a two-minute job… if you know where the file goes and what permission to give it. 90% of “my bot doesn't work” cases are actually terminal permissions or missing history. Here is the full process and, further down, the checklist for when something won't start.
Before you start
- The expert advisor file, usually with the extension
.ex5. If you've been given the.mq5, you first need to compile it in MetaEditor. - MetaTrader 5 open with the account you're going to test with. Always start with a demo.
- The symbol in Market Watch, and with a little history downloaded (open its chart for a minute and let it load candles).
Step 1 · Open the data folder
In MetaTrader 5: File → Open Data Folder. This opens the folder where the terminal stores
everything of yours (profiles, templates and programs). Inside it, the path we're interested in is
MQL5\Experts.
Step 2 · Copy the file and refresh the Navigator
Copy the .ex5 into MQL5\Experts (if you want to keep things organised, inside a subfolder
with its name). Go back to the terminal and, in the Navigator, right-click on
Expert Advisors → Refresh. The expert advisor should appear there.
Step 3 · Authorise algorithmic trading
There are two permissions and you need both:
- In the terminal: button «Algorithmic trading» on the toolbar (or Tools → Options → Expert Advisors → Allow algorithmic trading). It must remain enabled.
- In the expert advisor: when attaching it, on the tab «Common», tick «Allow algorithmic trading» and decide whether it can trade only on demo or also on a live account.
Step 4 · Attach it to the correct chart
Drag the expert advisor from the Navigator to the chart of the symbol and timeframe you want. Its properties window opens with two tabs that matter:
| Tab | What is configured |
|---|---|
| Common | Permissions: algorithmic trading (yes/no), trade only on demo or also live, and whether it can open files or make web requests |
| Inputs | The parameters the programmer has left configurable (risk, schedules, limits). If the expert advisor carries them inside the code, this tab appears empty: that means there is nothing that can be set incorrectly |
Step 5 · If the expert advisor makes web requests
MetaTrader 5 blocks by default any internet connection made from an expert advisor. If yours sends or receives data from a website (for example, to publish its markings or read levels), you must authorise the exact address in Tools → Options → Expert Advisors → Allow WebRequest for the following URLs, adding it to the list. Without that permission, the call returns an error even if everything else is correct.
Step 6 · Check that it is working
- The smiley in the top-right corner of the chart: smiling = authorised; sad = loaded without permission.
- «Experts» tab of the terminal (bottom panel): that is where messages and errors are read.
- «Trade» tab: if there are orders or positions, they appear with their identifier.
- Icons in the corner: if the algorithmic trading button is greyed out, there is nothing you can do until you enable it.
When something does not work: six causes, in order of probability
| What you see | What happens | Solution |
|---|---|---|
| Sad face | Algo Trading permission missing (terminal or 'Common' tab) | Enable in both places |
| Does not appear in the Navigator | File in another data folder or not refreshed | Check the path MQL5\Experts and click Refresh |
| It smiles but does not trade anything | Time filter, high spread or entry condition not met | Check the log and the time parameters |
| Numerical errors in the log | Lot below the minimum, stop shorter than the symbol minimum or insufficient margin | Adjust risk or distance; for synthetics, check the symbol contract |
| The expert is unloaded when changing timeframe | Changing chart can unload experts depending on the terminal settings | Watch the face after each change; check the unload-on-period-change option |
| Stops trading at night or when the computer is switched off | The expert lives inside the terminal | Leave the terminal open on a computer that is switched on or use a server |
If you need it to work 24/7
An expert needs the terminal open. For synthetic indices, which trade without pause, this is relevant: if you switch off the computer, trading stops. There are two realistic options: a computer you can leave switched on, or a Windows server running MetaTrader 5 with the session open. The managed hosting offered by MetaQuotes (its VPS service) is designed to host experts and indicators, not to install your own programs: if your system also needs an external program (for example, a Python bot or a local connector), it has to be your own server.
Frequently asked questions
Where is the EA file copied to in MetaTrader 5?
In the terminal data folder, within MQL5\Experts, which is opened from File → Open Data Folder. Then you have to refresh the Navigator so that it appears in the Expert Advisors branch.
Why is the EA's face sad?
Because it is loaded without permission to trade. This is solved by enabling the terminal's 'Algo Trading' button and ticking 'Allow Algo Trading' on the expert's 'Common' tab. If necessary, also enable the general option in Tools → Options → Expert Advisors.
Why does it not send trades even though it is authorised?
For execution reasons: symbol without history, lot below the minimum, stop shorter than the permitted minimum, spread above the filter, daily market pause or a time filter. The log on the 'Experts' tab usually indicates the exact reason.
My EA needs to connect to a website: why doesn't it work?
Because MetaTrader 5 blocks experts' web requests until you authorise the exact address in Tools → Options → Expert Advisors → Allow WebRequest. Without that permission the function returns an error and the expert is left without data.
Can it trade if I switch off the computer?
No. The expert runs inside the terminal: if MetaTrader 5 closes, it stops trading. For it to work without depending on your computer, you have to use a server (VPS) with the terminal open.
Can it be tested without risking money?
Yes, and it is mandatory before putting money in: first the Strategy Tester to validate the logic and then a demo account with the same broker for a period that includes quiet days and busy days.
Installed doesn't mean ready
At the academy, no expert advisor is allowed to trade until you understand which rules it executes and with what size. The installation is the easy step; the one that decides the result is the other.
Keep reading
- EAs and bots for MetaTrader 5What is worth automating and what is not.
- How an EA works internallyOnTick, orders, rejections and how to debug it.
- Copy trading with MT5How trades are copied without copying other people's risk.
- Risk management in synthetic indicesThe limits you should set before leaving the bot on its own.
- All guidesComplete content index: synthetics, trading, automation, forex and gold.