BLOG

  • Home
  • Blog
  • How to Install an Expert Advisor in MetaTrader 4/5®

How to Install an Expert Advisor in MetaTrader 4/5®

11/11/2021 10:00:00 PM
  1. Robot in MT4(5)®: How to Tame a Trading Idea
  2. How to Configure Autotrading Parameters 
  3. How to Place EA Files 
  4. How to Install a Trading Robot on the Platform 
  5. How to Configure EA Parameters 
  6. EA Basic Settings
  7. How to Disable an Expert Advisor 
  8. In Conclusion. What Should I Do?

Robot in MT4(5)®: How to Tame a Trading Idea

A trading robot or an Expert Advisor is a strategy whose algorithm is implemented as a code. All operations are automatically performed after you start the robot in the selected terminal application. 

However, you can stop the process at any time and manage trades manually.

How to Configure Autotrading Parameters 

Enable automated trading on the platform before launching the EA. 

Go to Settings —> Expert Advisors —> Allow automated trading —> mark Disable automated trading when the account has been changed, Disable automated trading when the profile has been changed, Allow DLL imports, Allow WebRequest for listed URL.

Autotrading Mode in MetaTrader 4®

Autotrading Mode in MetaTrader 4®

With the Allow automated trading option, you can enable/disable trading operations using automation tools. If this option is deactivated, EAs and scripts will be active. However, they can’t trade. This mode will be helpful for testing scripts in real-time. 

  • Disable automated trading when the account has been changed. This option is the protective mechanism that deactivates all connected EAs. This happens if another account becomes activated in the terminal. 

  • Disable automated trading when the profile has been changed. This option prevents the use of incorrect settings. Information about the current EA configurations is recorded in the profile. When changing the profile, these robots will continue to trade with the first tick. Current EAs from the previous profile will stop functioning. 

  • Disable automated trading when the chart symbol or period has been changed. This option deactivates the automatic orders opening if you decide to change the asset or the timeframe.

  • Disable automated trading via Python API. This option is inactive by default. Scripts that integrate with the trading platform can perform trading operations.

  • Allow DLL import. You can use external libraries and options with no limitations. If the MQL4 or MQL5 script applies DLL (but the call function is disabled), the OK button won’t be reflected in the launch window. 

Autotrading Mode in MetaTrader 5®

Autotrading Mode in MetaTrader 5®

Note! Using external libraries of the .dll, .dat, or WebRequest format can enhance EA’s capabilities. However, it can be dangerous for your deposit. If you doubt the security of the application being launched, don’t enable this option. Deactivate it when working with unknown trading robots. 

  • Allow WebRequest for listed URL. This option is available in the MQL5 language. It allows receiving and sending information from websites using GET and POST requests.

So, we have examined the general parameters. Let’s move on to installing a specific Expert Advisor. 

How to Place EA Files 

Make sure you have all the necessary EA components:

  • The base file with the source code in the .mql4 or .mql5 formats. This file is created and edited in MetaEditor. Then the source code is compiled into an executable file.

  • The obligatory executable file in .ex4 or .ex5 formats with which the terminal works. You can’t edit this module in MetaEditor. However, you can modify the EA’s algorithm in the .mql4 or .mql5 files and compile it. 

  • Additional library files with the .dll or .dat extension. 

  • The preset file (.set).

If you have the .mql4 or .mql5 file, but there is no executable one, create it in MetaEditor. Coders supply paid trading robots with an executable module. So, the presence of MQL files isn’t crucial for normal EA functioning.

Directory Structure of the EA Files

Directory Structure of the EA Files

Place Advisor’s components in the appropriate MT4(5)® directories:

  • Move DLL and DAT files in the ...\MQL4\Libraries\... (for MT4®) or ...\MQL5\Libraries\... (for MT5®).

  • Place SET file in ...\MQL4\Presets\... or ...\MQL5\Presets\...

  • Move MQL and EX files in ...\MQL4\Experts\... (...\MQL5\Experts\...).

If the EA uses additional indicators, place their files in the ...\MQL4\Indicators\... or ...\MQL5\Indicators\... directories. You shouldn’t set indicators on the price chart. The Expert Advisor must find and connect them. 

Each trading robot works in a separate chart window. Let’s take a closer look at how to install the EA in a terminal.

How to Install a Trading Robot on the Platform 

  1. Place the EA in the directory with the trading terminal. 
  2. Check for the executable file (.ex4, .ex5) in the ...\MQL4\Experts\... or ...\MQL5\Experts\... directory.
  3. Open the chart of the trading asset and select the timeframe optimal for the EA functioning.

You can install the trading robot on the price chart in the next ways:

Installing an EA from the Data Folder 

  1. Press CTRL+SHIFT+D or click on File on the toolbar —> Open Data Folder.
  2. Select the executable file.
  3. Launch.
Data Folder: Installing an EA in MT4®

Data Folder: Installing an EA in MT4®

Data Folder: Installing an EA in MT5®

Data Folder: Installing an EA in MT5®

Installing an EA via Navigator Option

  1. Choose  from the main menu.
  2. Select the necessary option in the Expert Advisors field. Double-click on the robot’s name and drag it on the opened chart. 
  3. Refresh Navigator
Navigator: Installing an EA in MetaTrader 4®

Navigator: Installing an EA in MetaTrader 4®

Navigator: Installing an EA in MetaTrader 5®

Navigator: Installing an EA in MetaTrader 5®

Note! Did the EA appear in the Expert Advisors or Scripts list? So, it has correctly been loaded into the system and is ready to work.

Installing an EA from the Market Mode 

  1. Select the appropriate EA.
  2. Download it to the terminal. 
  3. Act according to the installation scheme through Navigator.
Market: Installing an EA in MT4®

Market: Installing an EA in MT4®

Market: Installing an EA in MT5®

Market: Installing an EA in MT5®

Note! Before installing the robot, carefully read the description. It may contain recommendations for testing, assets, or timeframes.

A new Market folder will appear in Navigator after loading the Advisor. All EAs downloaded from the store will be saved here.

Note! There are not many free tools in the store. All quality and helpful software is paid for.

The EA in the MT4® Store: Install for Free or Buy

The EA in the MT4® Store: Install for Free or Buy

The EA in the MT5® Store: Install for Free or Buy

The EA in the MT5® Store: Install for Free or Buy

Installing Python Scripts

Thanks to the Python integration module in MetaTrader 4/5®, there are a lot of libraries for:

  • Machine learning 

  • Automation

  • Data analysis 

  • Visualization

In the Navigator mode, Python scripts are displayed with special icons. You can use Python scripts on the same chart together with ordinary Expert Advisors. 

Python Scripts: Installation in MetaTrader 4®

Python Scripts: Installation in MetaTrader 4®

Python Scripts: Installation in MetaTrader 5®

Python Scripts: Installation in MetaTrader 5®

To disable the use of Python libraries, choose the appropriate option in the platform settings.

After you installed all scripts, consider the icon in the upper right corner of the chart. 

  • If there is a smiling emoji or   a green icon, the robot is working fine. It can trade according to the built-in strategy.

  • If a sad emoji or a red icon appears , then the EA is working incorrectly. You have to check the terminal settings, parameters, and file placement.

The EA Status After Installation

The EA Status After Installation

Note! Only one trading robot can function on one chart simultaneously. If you connect a new EA, the previous one will stop and be removed from the current chart. To run the same Expert Advisor again (but with different parameters), open an additional chart. Repeat the procedure for robot installation. 

How to Configure EA Parameters 

The properties window appears before launching the trading robot on the chart.

EA Properties in MT4®

EA Properties in MT4®

You can see the next information about the script in the EA parameters (in the Common tab):

  • Name

  • Short description 

  • Version 

  • Data on developers 

  • Licensing data (expiration date, number, version)

Managing auto trading in this mode enables or disables the functioning of EAs. But even if this option is activated, you can prohibit trading through platform Inputs.

The Dependencies option appears if the robot imports functions from other EX5 and DLL files. This scheme displays the files that the active EA is accessing. 

  • Functions called from MQL are green.

  • Functions called from DLL are red.

EA Parameters in MT4®

EA Parameters in MT4®

EA Parameters in MT5®

EA Parameters in MT5®

The signals setting mode allows configuring external signals. 

In the Expert Advisor settings window (on the Input tab), you can customize your robot’s parameters. The MagicNumber parameter must be unique for each running script instance. This will allow you to split the created orders while working simultaneously.

Each Expert Advisor has an individual set of parameters. It is determined by the program code. So, for example, you can change the lot size. To change the parameter, double-click on its value and choose a new one. 

EA developers can provide additional inputs. 

If the trading robot has an attached SET file, you can connect this template via the corresponding Load button. 

Also, you can create an individual preset by clicking on the Save button. 

To restore the default settings, click Reset.

Note! Presets are stored in the …\Presets… trading platform directory.

To adjust settings for the already installed EAs, stop the execution process. 

You can load a set of previously saved parameters or presets and save custom settings. 

EA Basic Settings

There are several parameters, the functions of which are similar in different EAs:

  • LotSize, Lot, MicroLots — the lot size

  • MoneyManagement — the automated EA management 

  • Comment — comments to the robot’s orders

  • MagicNumber — the unique code to identify the EA orders

  • GmtOffset — platform time

The Expert Advisor opens an order only when all the parameters meet the trading conditions.

Note! You can change the EA parameters on the symbol chart but not in the Navigator window.

To run several copies of one trading robot with different parameters, it is enough to install it on various charts. Independent copies of the program are created with different parameters. These copies work independently of each other.

How to Disable an Expert Advisor 

To deactivate an EA, do the next:

  1. Click on the AutotTading button placed on the toolbar.
  2. Stop the auto trading process. In this case, the terminal won’t execute trade orders of active robots. 
How to Disable an EA in MT4®

How to Disable an EA in MT4®

How to Disable an EA in MT5®

How to Disable an EA in MT5®

The AutotTading button (or Service —> Expert Advisors) is responsible for global access. 

  • If you disable this function, automatic trading will stop for all EAs (even if this option has been enabled in the startup settings).

  • If you enable this option, all robots will auto trade.

In Conclusion. What Should I Do?

It is more convenient to control options through Navigator and not through the properties window. 

Navigator for each individual account displays:

  • All the EAs connected to it

  • The symbol chart on which it is running 

How to understand that automated trading is allowed for this or that Expert Advisor? Pay attention to the corresponding icon it will show you. 

You can manage the EA properties using the context menu commands. 

Also, you can apply to the Add to Favorites mode or Hotkeys for quick access to frequently used scripts, EAs, or indicators. They will be shown on a separate tab in Navigator

EA Control in the Navigator Option

EA Control in the Navigator Option

For example, you can assign a key combination to each script. When you press the hotkey, the script will be immediately enabled on the current price chart. 

Note! The EA works only during an active trading session. When the terminal is turned off (and quotes cease to arrive), the EA algorithm stops functioning. Since your open orders are placed on the broker’s server, they will remain active. You should manage them manually.

Imagine that the same trading account with the running EA is simultaneously opened both on the desktop terminal and on the mobile platform. When one of these terminals is closed, the Expert Advisor will continue to work in the remaining active session. 

Note! To make your trading fully automated, run the robot in the trading terminal with a VPS server. In this case, you can open and close any additional sessions. However, the EA will work as usual on the VPS server. 

The EA's performance depends on the algorithm efficiency and the accuracy of its software implementation. However, if the strategy is initially unprofitable, then no Expert Advisor can fix this sad situation.

If you have any questions, feel free to contact us via support4xdev.com. 

Make your trading pleasant  — order 4xDev creations

request

Do you doubt the reliability of the indicator? Want to check if there is no redrawing? Need an expert programmer to develop a custom Forex indicator? We will do it for you! Just fill in a form and get a free estimate of the price and time needed to develop the desired tool.

  • Home
  • Blog
  • How to Install an Expert Advisor in MetaTrader 4/5®