MT4 vs MT5 – comparing trading terminals


The first thing that should be noted and taken for granted is the absence of locks – opposite positions. Perhaps this is the main thing that causes bewilderment and, possibly, disappointment among some traders, while for those who trade without locks, this change is quite natural and logical. If we turn to other professional platforms, we will see that this is the rule there.

But there is an easy way to get around this problem. Open two accounts, one with only buy and the other only with sell, and you get a complete model of locking trading, simply split into two accounts. So you can find measures for each ban. Those who trade with locks according to this model will find it much easier to switch to classic trading. And at the same time, it will become possible to evaluate how the work without a lock is different. Perhaps this is where we can end the discussion of this problem.

I hasten to notice right away: MT4 will continue to exist, in fact, MT5 only expands the line of products from Metaquotes and is not intended to replace MT4. The developers on their website say: You can continue trading on the MetaTrader 4 terminal without fear that its support will be discontinued with the official release of the new MetaTrader 5 platform.
On the side of the MetaTrader 4 terminal, there is a huge database of codes and articles on the MQL4 community website .
At the same time, the new opportunities provided by the MetaTrader 5 platform will only increase, and you will be able to naturally master more and more new services

Now MT5 is not limited only to the forex market. It is possible to trade stocks, futures and other exchange instruments.

As the developers write: The new MetaTrader 5 trading platform is designed primarily to provide such an opportunity to trade stocks, futures, options and other exchange instruments. This will allow traders not only to use the familiar user-friendly interface when trading in different markets, but also to trade through different brokers. Traders will also have many built-in technical tools as well as those written by the .

An important innovation was the introduction of the concept of “position”.

In MT4, you can open several orders for one instrument at different levels. In MT5, you can also open several orders, but they all go to one position, and the trader will see only one position in the trading window. An important innovation is the Depth of Market, while in real work you can see the Depth of Market in some DCs that have launched MT5 in test mode.

Externally, the interface practically did not undergo any changes, this, of course, is only a plus. Menu names, icons, icons remain the same – it’s familiar, easy and convenient. There is no need to experience discomfort, as is the case with software products, when they change globally. For example, the interface of Windows 7 differs from Windiows XP quite strongly, and with the usual movements it is no longer possible to get to the desired functionality, and just with this in MT5 everything is in order.

The developers say about this: After the appearance of the MetaTrader 5 terminal, many traders noted that visually it did not change significantly compared to MetaTrader 4. During its development, all the conveniences and advantages that have always distinguished the terminals of Metaquotes Software Corp. have been preserved. from other terminals. Therefore, the transition to the new platform does not cause any difficulties for both traders and brokers, although there are, of course, differences in the architecture of both trading platforms.

We can happily find a large number of timeframes, I will mark the new ones in red : M1 M2 M3 M4 M5 M6 M10 M12 M15 M20 M30 H1 H2 H3 H4 H6 H8 H12 D1 W1 MN1

Probably, now there is no longer any chance of wanting some more TF , unless there is a desire to get a freely configurable timeframe. Some platforms do this. True, an M8 or M7 will not differ significantly from an M6 or M10.

Another pleasant innovation is the introduction of position control with the mouse. Now you can move stop and take levels with the mouse. By lightly touching the take or stop with the cursor, you can drag it to a new level with the mouse. This change has been asking for a long time. In MT4, it was partially implemented in various applications by programmers, and this was not a completely trivial way. An economic calendar has appeared in the interface, it is very convenient, and now the need to go to different sites and watch the release time of significant events has disappeared.

And finally, it became possible to enter a position with one click: now, by opening the “trade” tab in the “market watch” window, you can make transactions with one click.

Perhaps these are the main and main pleasant changes in the interface. History, an important point! Now the history is stored only in a minute, other TFs are recalculated from the minute history. Often, traders immediately after installing MT5, without loading the history, try to make hasty conclusions. This topic was discussed on the site in the closed part of the forum.

The figure shows that the lines are being rearranged, but they shouldn’t. I then explained: you need to download the history first, and then consider the graphs, if there is no correctly loaded data, then there is nothing to count. The story is loaded after the MT5 installation and takes a decent amount of time with a weak Internet channel. You need to wait for the download and make sure the data is loaded. In MT4, you could press F2 and view the quality of the history, in MT5 at the moment there is no such functionality, and, alas, it is not possible to examine the quality of the history.

Organization of data access

Receiving data from a trade server

Before price data are available in the MetaTrader 5 terminal, they must be received and processed. To receive data, a connection to the MetaTrader 5 trading server is required. Data is received from the server at the terminal’s request in the form of sparingly packed blocks of minute bars.

The mechanism for accessing the server for data does not depend on how the request was initiated – by the user when navigating through the chart or programmatically in MQL5.

Storing intermediate data

The data received from the server is automatically unpacked and saved in a special intermediate HCC format. Data for each symbol is written to a separate folder: terminal_directory \ bases \ server_name \ history \ symbol_name. For example, data on the EURUSD symbol from the Metaquotes-Demo trade server will be located in the terminal_directory \ bases \ Metaquotes-Demo \ history \ EURUSD \ folder.
The data is written to files with the .hcc extension, each file stores data of minute bars for a year.
For example, the 2009.hcc file in the EURUSD folder contains minute bars for the EURUSD symbol for 2009.
These files are used to prepare price data for all timeframes and are not intended for direct access.

Obtaining data of the required timeframe from intermediate data

Service files in the HCC format play the role of a data source for building price data for the requested timeframes in the HC format. Data in HC format are timeseries prepared as much as possible for quick access. They are created only at the request of a chart or MQL5 program in an amount not exceeding the value of the “Max bars in charts” parameter, and are saved for further use in files with the hc extension.

To save resources, timeframe data is loaded and stored in RAM only when necessary; in the absence of data access for a long time, it is unloaded from RAM and saved to a file. For each timeframe, data is prepared regardless of the availability of ready-made data for other timeframes. The rules for the formation and availability of data are the same for all timeframes. Those. despite the fact that the unit of data storage in the HCC format is the minute bar, the presence of data in the HCC format does not mean the presence and availability of the M1 timeframe data in the HC format in the same volume.

Receiving new data from the server causes automatic updating of the used price data in HC format for all timeframes and recalculation of all indicators that explicitly use them as input data for calculation.

“Max bars in chart”

parameter The “Max bars in charts ” parameter limits the number of bars in HC format available for charts, indicators and MQL5 programs. This limitation applies to data of all timeframes, and is intended primarily to save resources.

When setting large values ​​of this parameter, remember that if there is a sufficiently deep history of price data for lower timeframes, memory consumption for storing timeseries and indicator buffers can be hundreds of megabytes and reach the limitation of RAM for the client terminal program (2GB for 32-bit MS Windows applications) …

Changing the “Max bars in charts” parameter takes effect after restarting the client terminal. By itself, changing this parameter does not cause an automatic call to the server for additional data, nor the formation of additional timeseries bars. A request for additional price data from the server and updating of timeseries taking into account the new restriction will occur either when the chart is scrolled to the area of ​​missing data, or when the missing data is requested from an MQL5 program.

The volume of data requested from the server corresponds to the required number of bars in this timeframe, taking into account the value of the “Max bars in charts” parameter. The limitation set by the parameter is not strict, and in some cases the number of available bars on the timeframe may slightly exceed the current value of the parameter.

Now I will describe the possibilities that have become available to those who know how to test and optimize. The new strategy tester is probably the best achievement in the new platform. It has become multi-currency, which opens up great opportunities for testing multi-currency portfolio strategies.
I wrote a multicurrency Expert Advisor in MT5 that uses the FLET BREAKTHROUGH (YURAZ) trading system. Look at the test results. In the first case, I used one EURUSD pair with a constant load of 0.6 lot.

In the second case, I used 6 pairs, lot 0.1.

When I wrote this Expert Advisor, the goal was to prove that the portfolio trading system gives smoother equity.

The multicurrency tester is an excellent tool for creating multicurrency trading systems. Another revolutionary change in usage when optimizing multiple processors. Microprocessor technology has long been moving towards multi-core. In simple terms, this is when one task can be broken down into parts and run on several processors, thereby increasing the speed of its solution. And the MT5 developers did a brilliant job with it! In MT5, it became possible to optimize a strategy on several processors. And you can not only test on two or three of your machines. You can, being, for example, in Kiev, use the processors of machines that are located in Moscow. This is solved with the help of so called AGENTS. To use the kernel of the machine that you have chosen as an ssistant for optimization, you need to run metatester.exe or metatester64.exe for 64-bit machines on it, specify the password and port. However, metatester will offer it himself. The port is optimally selected for each core.

On the remote machine, you need to run MetaTester.exe and specify which ports should be open for each agent; for each agent one processor, one port, one password. If you have a local network of two or three machines at home, you can use all the processors of these machines.

If you want to use the processors of your friends for optimizations, it is important to ensure that these machines have access from the Internet to the ports you specified, and if only your machines are on your home network, then Internet access on machines with agents is not required. On the machine on which you are testing, you need to register an agent, give it a name, specify the IP address or domain address and port on which this processor sits. As is known, one machine can have several cores, and an agent can be attached to each core.

Then, on the machine where you run testing, register the agent. When all agents are registered, you can use the entire “park” of your home processors.

Thus, for optimization, all the power of your home machines will become available, and machines that can be located anywhere, it is important that they have access to the Internet, are turned on at the time of testing and the agent is running on them. The optimization process is much faster

Here is what Renat Fatkhullin, CEO of Metaquotes, says: In MetaTrader 5, we provide the ability to create entire settlement farms to speed up the calculation of trading strategies with the tester. They are designed to carry out massive optimization calculations, when hundreds of tasks can be run in parallel on remote computers. Moreover, on each computer, several agents can be installed according to the number of cores to maximize resource utilization. By default, each terminal has local agents based on the number of logical processor cores and can distribute tasks to other remote agents. It is very easy to install remote agents – just use the MetaTester.exe utility (one file, it doesn’t need anything else) and install agents as services by the number of cores or run them individually. Each agent has a password for access so that only authorized users can connect to it.
This is how testing an Expert Advisor on a local kernel looks like. Not only the status is shown, but also the actual CPU utilization.

did a little research on my home machine.

  • 8 cores I7-920
  • overclocking a little over 3 MHz
  • RAM 16GB
  • Strip array for 4 hard drives – (this is a relatively fast disk array)
  • A home-use machine, of course, may not seem as powerful as it was at the beginning of 2008. Agent was installed on each core, ports to the Internet were opened. Then, on a weak laptop via the Internet (3G connection at a very low speed), an optimization test was carried out with the connection to 8 cores of my home little monster. The test time is 4 minutes. Then I ran the EA without connecting to agents and got a test time of almost 50 minutes.The difference is more than 10 times. Of course, I cleared the cache to measure the time accurately! So multicore is the future and a real chance to buy time when choosing the parameters of your system. This suggests that traders need to unite and create clusters from processors – this way you can get high-performance optimization. A group of traders can agree with each other and open their processors to each other for collective optimization. Thus, you can get a smart multiprocessor cluster. You can use the idle computing power of office machines at work, as a rule, the servers are not always loaded. Many thanks to Metaquotes for such a service. These guys at Metaquotes know their stuff. In MT5, it became possible to create robots using the strategy generator. HOW TO CREATE A SIMPLE TRADING ROBOT BY YOURSELF. Now you can create your own modules of trading signals, trailing stop and money management, and simply connect them to a new Expert Advisor at the stage of code generation by the “MQL5 Wizard”.

Creation of ready-made Expert Advisors

  • “MQL5 Wizard” allows you to create fully functional Expert Advisors based on the standard library supplied with the client terminal. In order to start generating an Expert Advisor, you need to select the “Expert Advisor (Generate)” item on the first page of the “MQL5 Wizard”. The process of generating an advisor consists of several stages.

Common parameters

In this window, you must fill in the following fields:

  • Name – the name of the advisor, the same name will be assigned to the expert file;
  • Author – the name of the author;
  • Link – the developer’s email address or website.

Below is a set of required parameters created by default:

  • Title – the name of the advisor. This name will be added to the EA as an input parameter;
  • MagicNumber – magic number that will be used for the advisor. This number can be used to identify trading operations that were carried out by this particular expert.
  • EveryTick – in this parameter you can specify the EA operation mode. If set to “true” then the EA will process every tick arrival. If set to “false”, the EA will only work on openings of the bars of the chart timeframe to which it is attached.

The above parameters cannot be deleted. Even if you delete them from this window, they will be restored and included in it during the EA generation.

In addition to the required parameters, additional parameters can be added to the Expert Advisor, just like when creating an Expert Advisor template.


At this stage, the type of signal is selected, according to which the advisor will perform trading operations.

In the “Name” field, select one of the signal types from the list provided. Signals source code files are located in the folder: terminal_folder / MQL5 / include / expert / signal /. There is a specific set of parameters for each signal type:

  • Name – parameter name;
  • Type – the type of the parameter variable;
  • Value – the parameter value that will be used by default.

There are two modes for creating parameters, switching between which occurs by double-clicking the left mouse button on the icon. If a parameter has a highlighted icon, then it will be available as an input variable of the Expert Advisor (input variable). These parameters can then be used to optimize the Expert Advisor in the strategy tester. If a parameter has a gray icon, then it will be assigned a fixed value that cannot be changed from the EA properties.


At this stage, the type of movement of the Stop Loss level (trailing stop) is selected.

In the “Name” field, select one of the trailing types from the list provided. The source code files for these functions are located in the folder: terminal_folder / MQL5 / include / expert / trailing /.
There is a specific set of parameters for each type of trailing:

  • Name – parameter name;
  • Type – the type of the parameter variable;
  • Value – the parameter value that will be used by default.

There are two modes for creating parameters, switching between which occurs by double-clicking the left mouse button on the icon. If a parameter has a highlighted icon, then it will be available as an input variable of an expert (input variable). These parameters can then be used to optimize the Expert Advisor in the strategy tester. If a parameter has a gray icon, then it will be assigned a fixed value that cannot be changed from the EA properties.

Money management

At this stage, the type of money management for the advisor is selected.

In the “Name” field from the list provided, you must select one of the types of money management. The source code files for these functions are located in the terminal_folder / MQL5 / include / expert / money /.
There is a specific set of parameters for each type of money management:

  • Name – parameter name;
  • Type – the type of the parameter variable;
  • Value – the parameter value that will be used by default.

There are two modes for creating parameters, switching between which occurs by double-clicking the left mouse button on the icon. If a parameter has a highlighted icon, then it will be available as an input variable of the Expert Advisor (input variable). These parameters can then be used to optimize the Expert Advisor in the strategy tester. If a parameter has a gray icon, then it will be assigned a fixed value that cannot be changed from the EA properties.

After clicking the “Finish” button, the MQ5 file of the advisor will be generated. In order to start using it, you need to compile it using the “Compile” button or the F7 key.

The MQL5 Wizard uses the source codes of the corresponding classes of the Standard Libraries, which contain a simple description of all parameters set during the work of the “MQL5 Wizard”. In addition to those supplied with the terminal, you can write your own classes or create their descendants with the required functionality and place them in the appropriate directories.
Write your own classes in accordance with simple rules, and your trading signals, protective stop trailing methods and money management modules will be picked up by the “MQL5 Wizard” and can be used to create trading robots with richer functionality.


Now MQL5 has become object-oriented. For a trader, this may seem obscure and unnecessary.
But for those who realize all the desires of a trader – programmers – this is very important.

A trader ordering an Expert Advisor must understand what can be done using the built-in language, and what is impossible or difficult. Not everyone can correctly draw up a technical assignment. It’s not bad if a trader has at least a little idea of ​​what can be done in MQL5.

MQL5 has become faster than MQL4.
Benchmarks 2005
VC ++: Time: 47 ms, ResInt = -752584127 ResDouble = 17,247,836,076,609
Java: Time: 187 ms, ResInt = -752584127 ResDouble = 1.7247836076609E13
of MQL4: Time The: 797 ms, ResInt = -752584127 ResDouble = 17,247,836,076,609
Easy: Time : 875 ms, ResInt = 3369844457615319400 ResDouble = 3369844457615319400
Ami: Time: 12626 ms, ResInt = 3.36984e + 020 ResDouble = 3.36984e + 020
MQL2: Time: 22156 ms, ResInt = 333333383333717340000 32ResDouble
ms: 331733340000 TimeInt323 = 3.33333383333717E20 ResDouble = 3.33333383333717E20

In MQL5, we have not yet enabled speed optimization; as the developers say they will turn it on. At the moment, the speed at a certain type of operations
C ++ 31
MQL5 234
MQL4 719

New events have appeared in MQL5, they have introduced quite pleasant features of
OnTimer into the functionality – an event from the
OnTrade timer – an event when a trade event
occurs OnBookEvent – an event when the
depth of market changes OnChartEvent – processing of events that occur from a whole group of
OnCalculate events – occurs only in indicators – from the
OnTester tick – is generated at the end of testing

Now you can order Expert Advisors that work not only on events from the tick:

OnTimer For example, you can do which ones every x minutes or after a few seconds -that calculations. But before, programmers could also do all this in so-called looped EAs, just event-based programming has become more convenient and functional. Now you can write complete systems that work in real time.

OnTrade The OnTrade event is called when there is any change to the order. Change of take, stop or work of an order by stop or take, for pending changes in the open price. Previously, this required writing special tracking modules. This is now implemented inside MT5. And an event is simply called, within which processing can already be carried out.

OnChartEvent This is the richest event, it occurs when a number of events of

  • keyboard pressing
  • creating a graphic object,
  • deleting a graphic object,
  • clicking on the chart,
  • clicking on a graphic object belonging to the chart of the
    end of text editing in the input field of a graphic object

You can also add your own, custom events

OnBookEvent Occurs when the Depth of Market changes.
OnCalculate This event occurs in indicators when a tick arrives; you can also generate this event yourself.
OnTester Occurs at the end of testing, in this handler it is convenient to make final calculations after testing or to perform any of your functions.

Such innovations greatly simplify programming and add opportunities for creating
complete applications. We can say that with the help of MQL5, the opportunities to create a convenient trading system have increased by an order of magnitude.


Surely someone was expecting something more, possibly arbitrary timeframes, windows with instruments that can be opened outside the main window, someone is disappointed that MT5 does not support MQL4. Perhaps these will be the main complaints.

Moving instrument windows outside the main window: this is still a wish for MT5 and MT4 as well. There are a lot of traders who have two, three, four or more monitors, the monitors probably have different extensions and one main window is very annoying, since it does not allow scattering instrument charts on different monitors.
Regarding arbitrary TF. There are a lot of them in MT5, as for me it is quite enough.

I’ll go for M5 anyway, and probably won’t use M4; I will be interested in H6, H8, but I see no point in H7.
As for the lack of MQL4 support, this is probably the most sore point, and programmers will have to work hard here.

I think that indicators similar to MQl4 in MQL5 will soon appear, since the MQL5 language is quite strong in terms of features.

A final word from the developers: Therefore, summing up the brief summary of the review, we can say that, on the one hand, the new trading platform and the MetaTrader 5 client terminal is, of course, a revolution in the world of automated trading based on new horizons that have opened up for a trader. But on the other hand, this qualitative leap to a new stage of trade can be overcome without stress and together with the development of new resources in an evolutionary way.

In turn, I want to add: the community has received a new product. Again, it is not intended to replace MT4, it is just another tool with new capabilities, the main ones I tried to describe in this article.
Hopefully, brokers will soon launch MT5 on alert.


Please enter your comment!
Please enter your name here