Robot catalog

How to create trading robot - main stages

Friday, 22 December 2017 13:01
How to create trading robot - main stages

Each trader dreams that all the work for him was performed by a reliable trading robot, which is unaware of fatigue, fear and other human weaknesses. Some succeed in it, and they successfully reap the benefits of the work of their robotic assistants. Others are unsuccessfully looking for an effective trading strategy, which can be taken as the basis for creating an automated advisor. If you belong to the second category, then the information presented in this article will be very useful for you. So, let's look at the basic stages of creating a trading robot.

Creation of a trading robot – choice of approach

Traders are different people, therefore, to create an automated trading system, everyone is fit with personal characteristics and skills. For the years of the Metatrader 4 and Metatrader 5 terminals, there have been a huge number of such approaches. Let's single out the main ones:


The approach is based on the creation of a universal formula, which will take into account a lot of factors and allow the trading robot created on its basis to unmistakably determine the points for opening and closing trading positions. This method is used by traders who are firmly convinced that the price movement is made according to a clear algorithm that can be calculated by exploring historical data.

Often, proponents of this approach are good at mathematics, but do not know almost anything about the market. For them, it is not the effectiveness of strategy that is important, but the ability to prove their theory using calculations. As a result, many years of calculations and tests do not give the proper result.


In this case, the automated system is created, based of personal trader experience, which is gained by studying the laws of the market. At the same time, a trader builds his strategy on personal observations, and this requires a permanent location at the computer monitor. When he tries to transform his knowledge into a standard algorithm to create a sales advisor, there are some difficulties. Often, a trader cannot formulate trade rules so that programmers convert them into the language of algorithms.


This approach involves the creation of a commercial advisor on the basis of systems, which basically contain elements of artificial intelligence. Such systems are widely represented in the market as part of specialized software. In this case, the trader does not need to have either mathematical knowledge or programming skills. However, you need to have at least a basic understanding of indicators and technical analysis, as well as be able to use a specific package for working with neural networks.

The disadvantage of this approach is that an automated system based on artificial intelligence will act on its own, only known algorithm. Therefore, it is completely unknown how the robot behaves in a certain market situation.


By name, it is clear that this approach is chosen by traders-programmers, who prefer to spend several months writing a trading robot rather than to understand the wisdom of trading in financial markets. Usually, this approach does not lead to anything good. The fruit of such labor is a program created with the entire necessary infrastructure, but having almost nothing in common with an effective automated trading system.


In this case, a trader who does not understand anything in programming, math or features of the work of neural connections, simply buys a trading robot on a third-party resource. The main drawback of this approach is the inability to find out what the effectiveness of this robot is, until it is tested in practice.

Assessing the merits and demerits of each of the approaches, it becomes clear that for the person who is going to be seriously engaged in trading in financial markets, the second option is most appropriate. A wide trader's experience is the main base for creating effective trading robots. In addition, it is much easier for a person to create an automated system based on neural networks, if he is good at technical analysis and familiar with the laws of the market.

So, next, we'll talk about how to create a trading robot based on the trader's approach.

First steps on creation of a trading robot

To write a trading advisor, you must have programming skills, as well as know the intricacies of processing requests that are used in algorithms of automated systems. The study can begin with an introduction to existing trading robots, following  the link.

To understand the features of the work of trading experts, you need:

  1. Download any advisor.
  2. Go to the “Strategy tester” section of the Metatrader 4 or Metatrader 5 terminals and launch the robot on any trading tool.
  3. Select two areas on the chart: one with a clearly expressed trend, another – when the price is in a flat.
  4. Optimize all the parameters of the robot and compare how they differ on the both areas of the chart.

Therefore, you will understand how the behavior of the trading system varies in different market situations. It is also desirable to examine the work of several experts in order to understand the principle of the operation of trend and countertrend trading systems. As a result, you determine the most optimal parameters for creating an effective advisor, after which you can start learning the MQL4 or MQL5 programming language.

Programming of the expert

Having mastered the MQL programming language, it is time to transfer your knowledge to practice and write a trading robot for the MT4 or MT5 terminal. Here are several possible options:

  1. Write the robot on the basis of the architecture of an existing expert, making small changes to it in accordance with its strategy.
  2. Develop an advisor yourself. If there are any difficulties, you can ask for help from traders through thematic forums.
  3. Write the basic architecture, and order the finalizing details on freelancing or from a trusted specialist.

Knowledge of the programming languages ​​of experts at least at a basic level will allow making minor changes to the code and test trade advisors, which were finalized by specialists. Therefore, the study of MQL4 or MQL5 is an important stage in the development of any trader.

Optimization of a trading robot

So, you have created a trading advisor on your strategy, which gives very good results. However, the work does not end there. Sooner or later, there is a need to optimize the robot, no matter how ideal it may seem at first glance.

Since any automated trading system operates according to a certain algorithm, its efficiency decreases with time. The main thing is that this moment does not come at the first change in market conditions.

To make sure that an expert can work effectively for at least some time after launching it, you need to perform forward testing. This function is implemented in the Metatrader 5 terminal.

At the moment, there is no robot that would work with the same efficiency all the time, as it is impossible to fully transfer the trading strategy that the trader uses in live trading to the algorithm of the expert's work. Therefore, you should closely monitor its work and make the necessary changes to the parameters to adapt the advisor to market conditions.

Rate this article:
5 of 5 based on 1 rates
David Melton
David Melton

Financial expert. I work with investors and different companies. I write analytical reviews for newspapers and TV channels and I also manage researching projects