EA-ProgrammierungNordZentrum GmbH & Co. KG DERequest a quote

Guide · MetaTrader 5 and 4

Installing and starting an Expert Advisor

Where the file goes, how to enable automated trading and how to tell that the Expert Advisor is actually running. Plus what to do if the EA is not showing in the Navigator, the setup on a Mac and the five most common reasons why an EA is loaded but still doesn't trade.

Freely available, even without an order. Applies to MetaTrader 5 and MetaTrader 4.

01

Adding an Expert Advisor in MetaTrader 5

Five steps, about two minutes. The same procedure applies to MetaTrader 4, only the directory has a different name — see section 02.

01

Open the data folder

In the terminal, click File, then Open Data Folder. A window opens showing the installation's data folder.

Not the program folder under Program Files — the data folder is somewhere else
02

Go to the right directory

Open the MQL5 folder there and then Experts. Indicators belong in MQL5\Indicators instead, scripts in MQL5\Scripts, included libraries in MQL5\Include.

If the file is in the wrong folder, it won't appear in the Navigator
03

Copy the file in

The file with the extension .ex5 is sufficient to run it. If you also have the source code as .mq5, copy it in as well — then the system can be adapted later.

Create subfolders if needed; the Navigator shows them
04

Refresh the Navigator

Restart the terminal, or in the Navigator window right-click Expert Advisors and select Refresh. The Expert Advisor now appears in the list.

If it doesn't appear, see section 03
05

Drag onto the chart and allow trading

Drag the entry from the Navigator onto the desired chart. In the settings window under Common, tick the permission for automated trading, then confirm. In addition, the Algo Trading button in the toolbar must be enabled.

A blue hat appears at the top right of the chart in MetaTrader 5, a smiling face in MetaTrader 4, when everything is correct
02

Differences from MetaTrader 4

PurposeMetaTrader 4MetaTrader 5
Expert AdvisorMQL4\ExpertsMQL5\Experts
IndicatorMQL4\IndicatorsMQL5\Indicators
ScriptMQL4\ScriptsMQL5\Scripts
LibrariesMQL4\IncludeMQL5\Include
Templatestemplatestemplates
Parameter setsMQL4\PresetsMQL5\Presets
File exten­sions.mq4 and .ex4.mq5 and .ex5

Files are not interchangeable between the versions

An .ex4 file doesn't run in MetaTrader 5 and vice versa. The languages differ in essential points — MQL4 works with orders, MQL5 with positions. An existing system cannot be copied but has to be ported: MQL4 to MQL5 migration.

04

MetaTrader on a Mac

The procedure is the same, only the folder is somewhere else — and Finder hides it.

MetaQuotes offers its own macOS installer for MetaTrader 5. It sets up the Windows environment Wine as well and, according to the vendor, runs on macOS Catalina (10.15.7) or later, including Apple processors from M1 onwards (MetaTrader 5 Help).

01

Try the terminal first

In the terminal, choose File → Open Data Folder. If Finder opens with the MQL5 folder, continue as in section 01.

02

Otherwise use “Go to Folder” in Finder

In Finder, choose Go → Go to Folder (Shift-Command-G) and enter this path:

~/Library/Application Support/net.metaquotes.wine.metatrader5/drive_c/Program Files/MetaTrader 5/MQL5/Experts

Default installation path according to MetaQuotes; Finder does not show the Library folder otherwise
03

Copy the file, restart the terminal

Copy the .ex5 file into the folder, quit MetaTrader and open it again. The Expert Advisor then appears in the Navigator.

Limitations on a Mac

Older installations may use the folder ~/Library/Application Support/MetaTrader 5. If the start log shows a Wine version below 8.0.1, MetaQuotes recommends backing up your own files and reinstalling. Expert Advisors that load Windows libraries (DLLs) do not always run under Wine. And as on Windows: a Mac that goes to sleep does not trade.

MetaTrader 4 for Mac is provided by some brokers. The procedure is the same, with the folder MQL4/Experts.

05

Why isn't my Expert Advisor trading?

Five causes cover the vast majority of cases — check them in this order.

5.1

Algo Trading is not enabled

The most common cause of all.

  • The toolbar button is called “Algo Trading” in MetaTrader 5 and “AutoTrading” in MetaTrader 4. It must be green or active
  • Additionally per chart: the permission for automated trading must be ticked in the Expert Advisor's properties
  • Check after every restart — depending on the settings, the button may be off again
5.2

The icon in the chart shows an error

At the top right of the chart, right next to the name.

  • Blue hat in MetaTrader 5, smiling face in MetaTrader 4: running and allowed to trade
  • Grey hat in MetaTrader 5, sad face in MetaTrader 4: loaded, but without permission to trade
  • No icon at all: the Expert Advisor was not loaded — drag it onto the chart again
5.3

The market is closed or the symbol is wrong

A frequently overlooked point when changing broker.

  • Outside trading hours no order is accepted
  • Symbol names differ by broker: EURUSD, EURUSD.m, EURUSDi, EURUSD-ECN. A hard-coded name leads nowhere with a new broker
  • The symbol must be visible in Market Watch, otherwise the terminal doesn't supply prices for it
5.4

The log tells you why

The place where the answer almost always is.

  • “Experts” tab: output of the Expert Advisor itself
  • “Journal” tab: terminal messages, connection and order errors
  • As files in the data folder under MQL5\Logs or Logs — named by date
  • Typical messages: “not enough money”, “invalid stops”, “trade is disabled”, “market closed”, “invalid volume”
5.5

The conditions haven't been met yet

Not an error, but the normal case.

  • Many strategies trade rarely — days without a signal are nothing unusual
  • Time filters can limit trading to a few hours
  • To check, use the strategy tester: there you can see on historical data whether and when the system triggers at all
06

Continuous operation: why your working computer isn't enough

An Expert Advisor only trades while the terminal is open. A computer that goes into sleep mode at night, restarts after a system update or depends on a fluctuating connection interrupts trading — at the worst moment with an open position.

Three practical options:

Virtual server Your own Windows server with a provider, ideally close to the broker's data centre. Full control, several terminals possible, from around €10 to €30 per month.
MetaTrader hosting Built into the terminal as MetaQuotes' virtual hosting service. Very easy to set up, but limited to one terminal and less flexible.
Your own computer Only sensible if it runs continuously anyway, sleep mode and automatic restarts are switched off and the connection is stable.

We don't operate servers and don't act as agents for hosting providers. We support selection and set-up as part of an order — trading infrastructure.

07

Frequently asked questions about set-up

How do I add an Expert Advisor in MetaTrader 4?

In the terminal, click File, then Open Data Folder. The data folder opens. Go to the MQL4 directory and then to Experts. Copy in the file with the extension .ex4 or .mq4. Then restart the terminal or right-click Refresh in the Navigator window. The Expert Advisor then appears under Expert Advisors and can be dragged onto a chart.

How do I add an Expert Advisor in MetaTrader 5?

The procedure is the same, only the directory has a different name: File, Open Data Folder, then MQL5 and Experts. Copy in the file, restart the terminal or refresh the Navigator. Indicators belong in MQL5 and Indicators, scripts in MQL5 and Scripts.

Why isn't my Expert Advisor trading?

In the vast majority of cases it is one of these five causes: the Algo Trading button in the toolbar is not enabled. Or the permission for automated trading is not ticked in the Expert Advisor's properties. Or the icon at the top right of the chart doesn't show a blue hat (MetaTrader 5) or a smiling face (MetaTrader 4). Or the market is closed. Or the strategy's trading conditions simply haven't been met yet. The Experts log usually states the exact reason.

What does the icon at the top right of the chart mean?

In MetaTrader 5, a blue hat shows that the Expert Advisor is running and allowed to trade; in MetaTrader 4 it is a smiling face. A grey hat or a sad face means: it is loaded but not allowed to trade — usually because the Algo Trading button is off or the permission is missing in the properties. If no icon appears at all, the Expert Advisor was not loaded.

Where can I find the log files?

At the bottom of the terminal there are the Experts and Journal tabs, and during tests also Results. The Experts tab contains the output of the Expert Advisor itself, the Journal the terminal's messages including connection and order errors. As files, both are stored in the data folder under MQL4 or MQL5 and then Logs, as well as directly under Logs.

Do I have to compile the file?

Only if you received an .mq4 or .mq5 file, i.e. the source code. Open it in MetaEditor and choose Compile; this creates the executable .ex4 or .ex5 file. If you already have an .ex4 or .ex5 file, this step is not needed. From us you always receive both.

What is the difference between .mq4, .ex4, .mq5 and .ex5?

The files with mq are the readable source code, those with ex the executable program generated from it. Only the ex file is executed; only the mq file can be changed. If you only receive an ex file, you can neither adapt the system nor have it adapted by someone else — which is why the source code belongs in every delivery.

Does the Expert Advisor keep running when I close the terminal?

No. An Expert Advisor runs inside the terminal; if the terminal is closed, it doesn't trade. Continuous operation requires a server that runs around the clock — either a virtual server or the hosting service built into MetaTrader. A working computer that goes into sleep mode at night or restarts after a system update is unsuitable.

Does an Expert Advisor run in the MetaTrader app on my phone?

No. The MetaTrader apps for Android and iOS do not run Expert Advisors — this applies equally to MetaTrader 5 and MetaTrader 4. The app is suitable for monitoring the positions that an Expert Advisor has opened on a computer or server. The Expert Advisor itself runs exclusively in the desktop terminal under Windows or on a virtual server.

Does an Expert Advisor run in the MetaTrader web terminal?

No. The web terminal in the browser does not run Expert Advisors, custom indicators or scripts either. Automated trading requires the desktop terminal.

How do I open an .mq5 file?

An .mq5 file is the readable source code of a program for MetaTrader 5. It is opened in MetaEditor, which comes with MetaTrader: press F4 in the terminal or start the MetaQuotes Language Editor from the Tools menu. There you can read and change the source code; F7 compiles it, which creates the executable .ex5 file. The same applies to .mq4 files in MetaTrader 4's MetaEditor.

How much does MetaTrader 5 cost?

The platform itself is free. MetaTrader 5 is provided by the broker or by the maker, MetaQuotes, without a licence fee. Costs arise elsewhere: through spreads, commissions and overnight swaps with the broker, possibly for a virtual server for continuous operation, and for purchased or custom-programmed Expert Advisors and indicators.

How do I install an indicator in MetaTrader 5?

Like an Expert Advisor, just in a different folder: in the terminal, open the data folder via File, then go to MQL5 and then Indicators and copy in the .ex5 or .mq5 file. Then right-click Refresh under Indicators in the Navigator or restart the terminal. The indicator can then be dragged onto a chart. If only the .mq5 file is available, compile it first in MetaEditor with F7.

Why is my Expert Advisor not showing in the Navigator?

Usually the file is in the wrong folder: not the program folder, but the data folder shown by File and Open Data Folder, and there under MQL5 and Experts. Other causes: the file belongs to the other MetaTrader version (.ex4 instead of .ex5), only the source code is there and it did not compile without errors, the Navigator was not refreshed, or the terminal is older than the file. Systems bought in the MQL5 Market are listed in the Navigator under Market.

How do I install an Expert Advisor on a Mac?

As on Windows: copy the file into the MQL5 and Experts folder and restart MetaTrader. If File and Open Data Folder does not open the folder, use Go and Go to Folder in Finder and enter ~/Library/Application Support/net.metaquotes.wine.metatrader5/drive_c/Program Files/MetaTrader 5/MQL5/Experts. According to MetaQuotes, this is the default path of the Mac installer.

How do I move my Expert Advisor to a new broker?

In the new broker's terminal, open the data folder via File and copy the .ex5 or .ex4 file, with the source code if you have it, into MQL5 or MQL4 and Experts; saved settings are .set files under Presets. Then check symbol names, decimal places, minimum lot size and account type, because they differ between brokers. Run it on a demo account before the live account.

Can I get the source code back from an .ex5 file?

No. An .ex5 or .ex4 file is compiled; readable source code cannot be recovered from it reliably, and the licence terms of purchased systems usually prohibit it. Without the source code, the only option is a new development based on a description of the behaviour. That is why the source code belongs in every delivery.

Something isn't working as expected?

If an existing Expert Advisor throws errors or trades differently than described, we look at the source code and tell you what the cause is.

EA-Programmierung is a service of NordZentrum GmbH & Co. KG, Germany: Expert Advisors, indicators and trading systems for MetaTrader 5 and 4, cTrader, TradingView and ATAS, developed by André Liebetrau, Dipl.-Inf., a development service provider since 2009. Fixed price based on a written specification, complete source code included.

Describe the problem