A little bit of history
As little as 5 years ago, the MetaTrader 4 terminal was officially presented to the traders, written completely from scratch and intending to replace the existing, and already popular, third generation terminal of MetaQuotes Software Corp. MetaTrader 4 quickly gained popularity among traders, and as a consequence, in the following years, hundreds of brokers began to provide their services on the MetaTrader 4 platform.
Despite this success, 3 years ago developers decided to create an informatory - trading platform of a new generation, and in November of 2009 the public testing of MetaTrader 5 had begun. We all tend to take a strong liking to the known and the familiar and take a cautious approach to changes. Traders are no exception to this behavior. Therefore we decided to help, all who desired, to understand the differences and advantages of the MetaTrader 5 platform in comparison to the well-known MetaTrader 4.
New markets and instruments
From the beginning, MetaTrader was intended to be a convenient and user friendly platform for trading on the Forex market. Today, it is difficult to even imagine that many years ago, in almost all other terminals, trade was conducted on demand, it was not possible to create your own technical indicators and trading robots, and opportunities for technical analysis were implemented more in words than actual actions. And so, traders who sold through other financial markets began to express a desire to sell through MetaTrader.
The new trading platform MetaTrader 5 is designed precisely with the purpose to provide such an opportunity - to trade stocks, futures, options, and other stock-exchange instruments. This will allow traders to not only to use the familiar and user-friendly interface for trading on different markets, but also to trade through different brokers. Traders will also have access to the service of embedded technical instruments, as well as instruments written by the community MQL5.community.
Each terminal of the new generation was improved, not only visually, but also in its programming language, which you can use to write your own indicators, trading robots, and lots of MQL5 support programs in the form of scripts. New Language MQL5 differs from its predecessor by a better performance. Developers set a goal for themselves to achieve the same speed of program execution on the MQL5 platform, which is currently provided by ordinary, non-specialized, high-level languages.
In addition, the MQL5 language now allows you to create programs using object-oriented approach (OOP), which ultimately will give an even greater data base of pre-made programs, written by other traders and programmers. The code library on MQL4 is currently the largest in the world, and provides more pre-made examples than any other trading platform.
Using OOP has an even greater potential, and it isn't by chance that from the very beginning, the Code Base section on MQL5.com began to fill up with examples of programs that are difficult to implement on MQL4. At the same time, the MQL5 language allows you to write programs on the basis of a procedural approach, in cases when PLO is not required or has not yet been studied.
Events in the terminal
In addition to the new improvements of the language, which appeared in MQL5 with the emergence of classes, there is another significant detail that distinguishes the new language from MQL, - the with event model. Now within the program, you can track events mouses, keyboards, movements and changes of properties and graphics. There was an addition of processing timer events - now there is no need for writing scripts perpetual fascination.
And the most important thing - processing trade events. An executed Stop Loss, a withdraw of a pending order, a newly opened position, or an increase in an already opened position - are all examples of trade events. In addition, now all trading operations are performed asynchronously, after sending an trade request you can immediately continue working with the program, without waiting for the reply from the trade server unlike when working with MetaTrader 4.
Thus, the increased speed of execution of programs on MQL5, the use of Classes, event handling, and asynchronous trade requests allow us to implement a new type of trading robots, which were not accessible in MQL4.
Debugging the code in MetaEditor
Modern programming languages allow you to write programs with a very high level of abstraction, and MQL5, in this regard, is no exception. Complex programs contain an excessive amount of potential errors which are very difficult to detect without the help of special debugging tools. And so MetaEditor provided a debugger, so essential to programmers.
Now you can trace the program step by step, view the value of variables at any given time period, set up support points in the right places. The language now contains special additional features, designed to facilitate the process of finding problem areas in your code. Developers tried to implement all of the functional, required for debugging, which is familiar to all who developed programs in the modern development environments.
Also, the client terminal in MetaTrader 3 contained a strategy tester, which allowed testing of automated trading system on historical data. The MetaTrader 4 tester was drastically improved, with the addition of testing by ticks and the ability of visual testing. It became possible to optimize input parameters, not only by going through all of the options, but also by the usage of genetic algorithms, which achieved accelerated optimization.
The MetaTrader 5 terminal uses a tick by tick strategy tester, and the implementation of the algorithm for the generation of ticks allows you to obtain the most accurate test results. But one of the major advantages of the new item is the possibility of testing the program on a set of instruments, the so-called portfolio tests. In this type of testing, the terminal automatically downloads the history of each instrument that you need, once you first launch the portfolio of testing, re-downloading the history is not required.
It's been a long time since modern computers began to be built with two to eight cores for computing tasks, and that operating systems began to allow you to distribute the load within the cores, with the presence of the appropriate software. The tester in the MetaTrader 5 terminal was initially planned in such a way that allowed to utilization of all of the available computer cores to optimize the input parameters of Expert Advisors. The terminal automatically creates one local testing agent for each available core, and the user can choose which core to use.
Thus, the time for optimization on a multi-core computer is greatly reduced; the tester automatically assigns each agent the testing parameters and the interval to for the next passage. But that's not all - you can use any available computer, both on a local network and via the Internet. To do this you need to install on the required number of testing agents on a remote computer, using the MetaTester.exe utility.
Thus, we can turn the company's local network into a vast computer network and use all of the computing resources by 100%. The remote agent received the required testing history from the tester, thus there is no need for multiple requests to the server. Access to remote agents is securely protected by a password.
Within the agents the following protection mechanisms are implemented:
- fully encrypted network protocol between the client terminal and the agent with a compression of traffic;
- Access to the password;
- the ability to specify a list of IP addresses, from which connection is allowed to the client terminal;
- only local agents can use DLL with the appropriate terminal resolution;
- the transmitted Expert Advisor code is never stored on the agent's disk, but is instead transferred in a transformed state, which is inaccessible by the dump;
- the agent does not know the name of the Expert Advisor and doesn't store the miscalculation results on the disk (minimizes the amount of information retained calculations are completed);
- The agent is protected from dissemble or modification by a hinged security shield.
Thus, the tester on the MetaTrader 5 terminal provides solutions for such complex problem of Expert Advisor optimization, which traders would not dream of being able to solve without access to supercomputers.
If you do not have an Expert Advisor
Automated Trading is becoming more popular with every passing year, but what new advantages does the MetaTrade 5 terminal provide to traders who do not have Expert Advisors or perform only manual trading? If you do not have experience in writing indicators and trading robots, you can order them online on the following web site: MQL5.community topic Work. This service has been planned and will be accessible shortly. For programmers who write custom Expert Advisors, this will be an excellent platform for offering their services.
In addition, traders often search for an opportunity to obtain or publish trading signals on a paying basis. This may be due to the inability to formalize some trading strategies and the need to conduct all operations manually. The ability to sell signals can serve as an additional prize for the professionals. For novices, a subscription to the new trading signals will help to protect the deposit from the inevitable errors, which are often made in the beginning.
But before you subscribe to receive these signals, you must be fully sure of the reliability of statistics, provided by the signals trader. This can be test reports of the proposed trading system, if it is implemented in the form of an Expert Advisor. But even this cannot fully guarantee the stability of the system in the future, so investors are more interested in statistics of trade operations, carried out on real or training accounts, over a long period of time. Specifically for this purpose, another service will soon be added to the MQL5.com web site, which will provide the ability to monitor accounts on the MetaTrader platform 5.
Only one thing can be added to everything which was stated above, and that is that developers are not planning to end their achievements with the development of this new platform. All of the services described here will in the near future be integrated directly into the MetaTrader 5 terminal and into MetaEditor 5. The MQL5 language will also be further modifies in order to provide access to new services in the simplest way possible.
Evolution of Trade
Many traders noted after the creation of the MetaTrader 5 terminal that visually it did not differ much from MetaTrader 4. During its development, all of the amenities and benefits, which always distinguished the terminals of MetaQuotes Software Corp. were preserved. from other terminals. Therefore, the transition to the new platform does not produce difficulties for traders and brokers, although there are a number of architectural differences between the two trading platforms.
You may chose to continue trading on the MetaTrader 4 terminal, without fearing that its technical support will be discontinued with the official release of the new MetaTrader 5 platform. The advantage of the MetaTrader 4 terminal is the huge database of accumulated codes and articles, which can be found on the following web site MQL4.community. At the same time, the new features, provided by the MetaTrader 5 platform, will only multiply, and you will naturally learn how to use more and more of its new services MQL5.community.
Therefore, summing up the above review, we can conclude that on the one hand, the new trading platform and the MetaTrader terminal 5 certainly demonstrate a revolution in the world of automated trading, by opening up so many new horizons for traders. But on the other hand, this qualitative leap to a new level of trading could be overcome without stress with the development of new resource in an evolutionary way.
Translated from Russian by MetaQuotes Software Corp.
Original article: https://www.mql5.com/ru/articles/84