How to Launch Trading Robots in MetaTrader 5?
Information is not investment advice
In the previous article dedicated to the basics of algorithmic trading, we looked at its origins and the most popular languages for creating trading robots. As we chose MQL5, the language of MetaTrader 5, for learning algo trading, let’s look at the main types of trading robots and where to find them in the MT 5 environment.
MQL5 documentation describes four types of automated trading applications: scripts, services, custom indicators, and expert advisors. They differ by tasks they implement.
A script is a program that executes only one action. This is the simplest form of trading robot in MQL5. Scripts can make alerts when a certain level is reached, modify your stop loss and take profit levels, and even gather historical data of your trades.
Service is an application that works without being attached to the chart. Like scripts, services implement only one function.
A custom indicator is a technical indicator that is developed by a user. It can be a modification of standard indicators or a completely new one. Just like standard indicators in MetaTrader 5 (MACD, RSI, moving averages, etc.), custom indicators do not make trades automatically. They are used as additional instruments for technical analysis.
Expert Advisor (EA) is the most complex type of trading robots that can be programmed in MQL5. They can perform trading operations based on a pre-identified trading strategy. EAs follow a special pre-programmed algorithm and place orders according to that set of rules.
Now, since we know the main types of automated trading programs, let’s learn where to find them in MetaTrader 5.
Where to find trading robots in MT5?
All expert advisors, scripts, and indicators are stored in the data folder of MT5. To open this data folder, you need to click File – Open Data Folder. Click the MQL5 folder there to find indicators, expert advisors, scripts, and services. If you download custom indicators or expert advisors from the internet, you need to put them in this folder. This way, MetaTrader will see them.
If you look in a folder of any type of trading robot (for example, Experts), you can see that two connected files represent one program. They have the same name, but different directories: mq5 and ex5. The first one contains source code that can be opened in MetaEditor (the working environment for MQL5 programming), while the second file represents a compiled (converted) version of an MQL5 program that allows to launch it in a trading platform.
In MetaTrader 5, you can see all compiled programs in the Navigator window.
If you want to launch a certain indicator or expert advisor, double-click on it, or drag it to a chart.
This action will open the properties window of a chosen robot. To start it, click “OK”. If it’s successfully started, a green icon will appear in the upper right corner of the chart.
If the icon is red, the Expert Advisor is switched off. You need to enable algo trading in the EA's settings and the options of a trading platform.
Note: Only one Expert Advisor can run on one chart, but multiple indicators can be attached.
In the settings of any expert advisor, you can find the “Common” and the “Inputs” tabs. The “Common” tab contains general information about a robot. There are also two individual parameters: “Allow modification of Signal settings” and “Allow Algo Trading”.
The first option allows a program to subscribe to signals and edit signal settings. You will learn more about signals in MetaTrader 5 in the next articles dedicated to MQL5.
The option “Allow algo trading” limits the trading activities of expert advisors. Remember that even if this option is enabled, the automated trading may be disabled in the settings of MT 5. Be sure that you switched on both of them if you want to launch a robot.
The second tab of an expert advisor or an indicator contains input parameters. They allow you to adapt the application to your strategy, making it more flexible.
If you want to try out custom trading robots built by the members of the MQL5 community, go to Toolbox – CodeBase. It contains hundreds of trading robots that you can test yourself!
Or you can buy or download indicators, robots, and scripts directly from the MQL5 Marketplace.
This is the second article in the FBS algo trading course. In the next lesson, we are going to observe the functions of MetaEditor and look at the structure of a trading robot. Stay tuned!