CFDs are complex instruments and come with a high risk of losing money rapidly due to leverage. 72% of retail investor accounts lose money when trading CFDs with this provider. You should consider whether you can afford to take the high risk of losing your money.

CFDs are complex instruments and come with a high risk of losing money rapidly due to leverage. 76.09% of retail investor accounts lose money when trading CFDs with this provider. You should consider whether you understand how CFDs work and whether you can afford to take the high risk of losing your money.

72% of retail investor accounts lose money when trading CFDs with this provider.
76.09% of retail investor accounts lose money when trading CFDs with this provider.

How to enable, launch and customize Expert Advisors (robots) on your MetaTrader 4 platform?

Profile Picture
Author: Leon Marshall
Expert Advisors (EAs), also known as robots, are supplementary programs that can be activated or added to the MT4 platform to help you automate the trading process and analysis.

With the use of algorithms, expert advisors examine and analyse financial markets, searching for the best trading prospects. EAs are often used to automatically place and close trades, especially when it comes to multiple positions. They can send notifications to the trader or directly activate trading conditions like trailing stops and limits.

Once you have created an Eightcap account and know the basics of trading in MetaTrader 4, you are ready to explore the possibilities that EAs offer. Learning how to activate and customize expert advisors with this tutorial will make trading more efficient.

This MetaTrader 4 step-by-step tutorial will teach you how to:

  • Enable and launch expert advisors in MT4;
  •  Add and remove EAs from MT4 charts;
  •  Create and edit expert advisors in MetaEditor;
  •  Download expert advisors from the Market;

How to enable expert advisors in MT4

Before you start using and expanding your EAs, first you need to make sure that they are enabled and configured according to your trading account. To do that, use the “Auto Trading” button in the toolbar. A single click enables/disables the automated trading for your MT4 platform.

To enable EAs and to configure them, select “Options” from the main menu “Tools”.

From the Options window that pops up, go to the “Expert Advisors” tab and make sure “Allow automated trading” is ticked.

This enables the use of Expert Advisors and other scripts. Please note that even when this setting is deactivated, scripts and Expert Advisors may still seem active, but they will not be able to execute any trades. When in disabled mode, the analytic capabilities of the EAs can still be tested in real-time mode (they can be also tested with your history data). Enabling and disabling automated trading from the main menu or the toolbar effects the entire MT4 terminal, overwriting the settings of every individual Expert Advisor. To activate a particular EA, both the general auto trade settings and the settings of the EA itself need to be enabled.

From the Options window, you can set under what conditions auto trading is enabled. If you don’t want your EAs to remain activated when you switch to another account, tick the first option: “Disable automated trading when the account has been changed”. Similarly, you can disable it when you change your MT4 profile by selecting “Disable automated trading when the profile has been changed”. This option is particularly important since profiles usually contain a lot of chart data (including expert advisors attached to it). When this is ticked, you prevent EAs from another profile to be instantly activated and to start placing trades. Just as described, the last option “Disable automated trading when the charts symbol or period has been changed” allows you to deactivate EAs when you make key configurations to your charts: change of time period and symbol.

In this tab there are two more major functionalities that can be enabled:

  • “Allow DLL imports”, which concerns expert advisors that work with external DLLs (dynamic-links libraries). If this is deactivated, none of your expert advisors will be able to use DLLs. The MetaTrader platform recommends disabling this functionality when working with unreliable experts. DLLs allow developers to share data in order to update functionalities without the need to re-link and re-compile applications.
  • “Allow WebRequest for listed URL” – WebRequest is MQL4 functionality allowing the transfer of information to websites via GET and POST requests. To enable this in your MetaTrader 4, you need to also list the URLs of trusted websites that can use this function. By default, this is deactivated, due to safety concerns.

How to launch expert advisors in MT4

After you have enabled and configured the main auto trading parameters in MT4, you are ready to launch any individual expert advisor you want to use.

To do so, go to the Navigator panel and expand the Expert Advisors (EAs) group, which contains all expert advisors available on your platform. Open the context menu of the expert you want to activate and select “Attach to a chart” to add it to the chart active at the moment. You can also simply drag the EA to the chart.

When you confirm the activation, the window for configuring the EA will pop up. Although many of the EAs are different, most of their settings are similar. The expert window contains the tabs “About”, “Common” and “Inputs”. The “Common” tab allows you to select what positions the EA will be applied to: long, short or both. Here you can also set alerts and tick “Allow live trading” in order to activate the EA (note that EAs must be also enabled from the general MT4 settings; the same is valid for DLL settings).

“Allow import of external experts” controls the calling of functions from third-party EAs. Some experts may not work if this remains disabled.

Some expert advisors may also have the option to “Allow modification of Signals settings” – this enables the subscription to Signals (a subscription to a provider offering trading signals, providing the trader with suggested trades that they can copy in their own trading) and modifying them.

The ”Inputs” tab displays the parameters of the expert advisor with values that can be modified with a double-click of the mouse.

Here, you can also utilise prearranged sets of inputs. To import sets just click the “Load” button and use “Save” to keep your own values. Click “Reset” to go back to the default settings.

Note that just one expert advisor can be added to a chart. If second expert is attached, it will replace the first one on the chart.

The expert will be activated the minute the Properties window is closed. Once an EA is activated, it will execute when a tick comes in. During execution, the Properties window cannot be open, unless it’s while the EA is being restarted or in-between operations.

You can confirm that an expert is attached to a chart if you see its name and emoticon in the upper right corner of the chart. If live trading is disabled for this expert, the letter “L” will be on the place of the emoticon. You can click on the icon to open the Properties window. The symbol for dagger tells you that all EAs are disabled.

How to remove expert advisors from MT4 charts

As we have already established, EAs are removed when they are replaced with another robot or when you switch to a different chart or template, depending on your general auto trading settings. However, to directly close an expert, the trader needs to remove it from the chart. To do that, open the chart context menu, select “Expert Advisors” and then “Remove”.

When the platform is shut down, EAs stop working as well.

At the same time, the deletion of an expert from the Navigator doesn’t shut down the EA itself, if it is already attached to the chart. Deactivating experts in the general platform settings (in the Tools menu) does not disable experts entirely. This action prevents each expert from executing its start() function (immediately after a new tick comes), while the init() function (executed after the start of the terminal or after any change to accounts, charts and EA parameters including changing chart period, recompiling code, changing EA inputs or switching accounts) remains active.

Strategy Testing

MetaTrader 4 allows traders to test expert advisors before using them. This gives you the chance to test their efficiency under different market conditions and based on history data.

Select “Strategy tester” in the main “View” menu to open the Tester panel that enables you to test various strategies and to optimize the parameters of the EAs you want to use.

While adjusting the parameters of the EA, you can evaluate its trading efficiency and find out when profitability is at its highest.

How to create expert advisors in MetaEditor

How to use MetaEditor

As a platform MetaTrader 4 is very flexible and it allows various customizations, including the creation of EAs from scratch with the help of the MetaQuotes 4 (MQL4) language and the MetaEditor, which is installed automatically within your MT4 package.

The MetaEditor is component of the MT4 client terminal that’s utilised for the creation and editing of experts, indicators, libraries and other scripts written in MQL4.

To open the editing program, go to the Navigator panel, and click on top of the Expert Advisors group to open the context menu. Select the “Create in MetaEditor” option to open it.

Optionally, you can open the editor from the main “Tools” menu, from the MetaEditor button in the toolbar or by pressing F4.

How to create expert advisors with MQL4

With the MetaEditor open, you can start editing experts from your list or make a new one. Click the “Create New” button in the toolbar to start a new project and tick “Expert advisor”.

On the next step enter the name of the expert in development, the name of the developer (individual or company), link to the website of the developer and parameters needed (a list of inputs for the EA). Select “Next”.

The following windows contain settings on events. The events here signify the specific moments, in which you can execute the custom EA code. Initially, you can leave these settings as they are by default.

The expert you have just set up will open in the editor. Now you are ready to start writing your own code.

To compile the file after you’re finished with development, go to the “File” main menu and select “Compile”

or click on the “Compile” button in the toolbar (F5). This will create an executable program file with the .EX4 extension.

Your list of every compiled expert is updated in the Navigator panel on the left. If the file isn’t compiled properly, the icon of the EA appears grey.

How to edit expert advisors with MQL4 in the MetaEditor

With the MetaEditor you can easily edit any expert you have at your disposal by selecting “Modify” from the context menu of the EA. Note that once the changes are made, the file needs to be recompiled.

How to download expert advisors from the Market

Instead of writing your own experts, you can browse through thousands of paid and free EAs from the official MetaTrader website at https://www.mql5.com/

Go to the “Market” menu and filter your results for MetaTrader 4 and EAs. Here you can buy or download expert advisors that are not available on your MT4 platform.

Open the page of the robot and download it.

Once downloaded, the EA will be automatically installed and visible in the Terminal panel, in the “Market” tab.

The expert will also show up in the Navigator panel. Using its context menu, you can activate and modify it.

Instead of searching in the MQL5 website, you can simply open the context menu of the experts in the Navigator panel and select “Online library”. A list of available EA robots will open in the Terminal. Clicking on any of the experts will redirect you to its own page on the site. From there, the steps are the same as previously described.