Русский 中文 Español Deutsch 日本語 Português 한국어 Français Italiano Türkçe
New Opportunities with MetaTrader 5

New Opportunities with MetaTrader 5

MetaTrader 5Examples | 3 June 2010, 11:20
5 406 4
MetaQuotes
MetaQuotes

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.

MQL5 Language

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.

Portfolio testing

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.

Multi-thread optimization

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 Ltd.
Original article: https://www.mql5.com/ru/articles/84

Last comments | Go to discussion (4)
Heinrich Munz
Heinrich Munz | 28 Sep 2011 at 13:57

Rosh,

 

I have two questions regarding MT5:

1. 

On the Symbols Window in this article I can see IQFeed as a possible data feed. How is it possible to connect such kind of datafeeds (datafeeds I have subscribed to) into MT5?

Is Metaquotes providing "drivers" to such kind of data provders? 

Is there a (documented) API or any kind of a SDK so I can write own "drivers" to connect to other data feeds?

 

 2. This https://www.mql5.com/en/articles/75 article (The Algorithm of Ticks’ Generation within the Strategy Tester of the MetaTrader 5 Terminal) describes how ticks are emulated from higher time frame OHLC values. Is there a way to avoid this emulation of artifical ticks and provide the strategy tester with real historical ticks from a database I provide myself (ticks from other sources and self generated ticks). Especially the last point (self generated ticks) is very important to do QA-measures on self developed EAs (i.e. testing the EAs with well known, seld defined patterns).

I have recognized that MT5 creates *.hcc files. Are the historical ticks stored in there?

Is it possible to store real ticks in such files (not only >1 Minute Bars) and the Backtester then is using teh files I have generated?

Is there a description of the binary format of these files?

Or are there tools to import own tick data? 

 

Thanks for your help

Hanky

Rashid Umarov
Rashid Umarov | 28 Sep 2011 at 15:39
Hanky27:

Rosh,

 

I have two questions regarding MT5:

1. 

On the Symbols Window in this article I can see IQFeed as a possible data feed. How is it possible to connect such kind of datafeeds (datafeeds I have subscribed to) into MT5?

Is Metaquotes providing "drivers" to such kind of data provders? 

Is there a (documented) API or any kind of a SDK so I can write own "drivers" to connect to other data feeds?

No, there is not. Only broker can provide quotes for needed symbols into client terminal. You should ask your broker.
Rashid Umarov
Rashid Umarov | 28 Sep 2011 at 15:41
Hanky27:

 2. This https://www.mql5.com/en/articles/75 article (The Algorithm of Ticks’ Generation within the Strategy Tester of the MetaTrader 5 Terminal) describes how ticks are emulated from higher time frame OHLC values. Is there a way to avoid this emulation of artifical ticks and provide the strategy tester with real historical ticks from a database I provide myself (ticks from other sources and self generated ticks). Especially the last point (self generated ticks) is very important to do QA-measures on self developed EAs (i.e. testing the EAs with well known, seld defined patterns).

I have recognized that MT5 creates *.hcc files. Are the historical ticks stored in there?

Is it possible to store real ticks in such files (not only >1 Minute Bars) and the Backtester then is using teh files I have generated?

Is there a description of the binary format of these files?

Or are there tools to import own tick data? 


At all questions - No.
MEETALGO LLC
Mohammad Ali | 20 Sep 2013 at 06:20

Why don't MetaQutoes stop Metatrader 4. Or also give some deadline to stop Metatrader 4. Because new version is much better then older version. Two version making confuse people. ...

The Magic of Filtration The Magic of Filtration
Most of the automated trading systems developers use some form of trading signals filtration. In this article, we explore the creation and implementation of bandpass and discrete filters for Expert Advisors, to improve the characteristics of the automated trading system.
The Algorithm of Ticks' Generation within the Strategy Tester of the MetaTrader 5 Terminal The Algorithm of Ticks' Generation within the Strategy Tester of the MetaTrader 5 Terminal
MetaTrader 5 allows us to simulate automatic trading, within an embedded strategy tester, by using Expert Advisors and the MQL5 language. This type of simulation is called testing of Expert Advisors, and can be implemented using multithreaded optimization, as well as simultaneously on a number of instruments. In order to provide a thorough testing, a generation of ticks based on the available minute history, needs to be performed. This article provides a detailed description of the algorithm, by which the ticks are generated for the historical testing in the MetaTrader 5 client terminal.
Connection of Expert Advisor with ICQ in MQL5 Connection of Expert Advisor with ICQ in MQL5
This article describes the method of information exchange between the Expert Advisor and ICQ users, several examples are presented. The provided material will be interesting for those, who wish to receive trading information remotely from a client terminal, through an ICQ client in their mobile phone or PDA.
OOP in MQL5 by Example: Processing Warning and Error Codes OOP in MQL5 by Example: Processing Warning and Error Codes
The article describes an example of creating a class for working with the trade server return codes and all the errors that occur during the MQL-program run. Read the article, and you will learn how to work with classes and objects in MQL5. At the same time, this is a convenient tool for handling errors; and you can further change this tool according to your specific needs.