Perhaps the most interesting topic for today.
At least for me personally, the most interesting article of all.
I agree, the topic is relevant at the moment. It allows not to wait for DCs to swing.
Useful and relevant article, thanks to the author!
One confusing thing:
Чтобы не пропустить момент изменения позиции, следящая система должна быть реализована в функции OnTimer(), т.к. следить придется за всеми инструментами сразу, а тики приходят на разных символах в разное время. Также требуется передать сигнал об изменении содержимого файла.
Why not OnTrade()?
Why not OnTrade()?
I agree, normal OnTrade() processing is necessary, as well as an advanced Tamer. Their absence is a bug in any EA, especially in a mult...
And the author refused from libraries for nothing, you can do much more with them (I'm not talking about specialised software).
Although it is right, we have more room for imagination :)
PS
I would also like to see examples of different moments, not only averaging and pyramiding (I've seen only them, maybe I'm not attentive).
I proceeded from this:
1.2 Trading position volumes
Let's look in detail, does it make a difference which order to close? Will it not affect the profit? For example, we have two orders opened at different times and closed at different times, but they have overlaps in lifetime. That is, let's try to emulate a trading position in the order accounting system.
Let's calculate by variants what will happen to the profit, if we change the order closing levels in places:
type | volume | opening level | closing level |
---|---|---|---|
sell | 0.1 | 1.39388 | 1.38438 |
sell | 0.1 | 1.38868 | 1.38149 |
I would like to add a few words about DLL and additional software.
At the moment I am considering a variant allowing to transmit signals and exchange information with the help of DLL (with obligatory possibility to work with ini-files).
And the maximum task I see (my long-time dream) is to develop a server, the main task of which will be to collect and process information from different platforms (it would be good also from several clients).
I agree, the lack of a timer is a bug in any moult....
And it's a mistake for the author to give up on libraries, you can do much more with them (I'm not talking about specialised software).
Although it is right, we have more room for imagination :)
PS
I would also like to see examples of different moments, not only averaging and pyramiding (I've seen only them, maybe I'm not attentive).
I proceeded from this:
1.2 Trading position volumes
Let's look in detail, does it make a difference which order to close? Will it not affect the profit? For example, we have two orders opened at different times and closed at different times, but they have overlaps in lifetime. That is, let's try to emulate a trading position in the order accounting system.
Let's calculate by variants what will happen to the profit, if we change the order closing levels in places:
type | volume | opening level | closing level |
---|---|---|---|
sell | 0.1 | 1.39388 | 1.38438 |
sell | 0.1 | 1.38868 | 1.38149 |
The point of this example is to show that the profit depends on the money put on the forecast, in more complex cases will be the same (just did not want to load the article with a large number of examples proving the same thing).
Regarding libraries, I am not against ex5 libraries, but I don't want to use dlls because it discourages the end user.
And really, who wants to get a trojan along with the purchase. MQ tries to stick to security in its policy.
So I'm just sticking to their image, since no dll means the code is safe.
Useful and relevant article, thanks to the author!
One confusing thing:
Why not OnTrade()?
Interesting idea, everything that goes to the server will definitely be displayed in OnTrade(). But it is only necessary to filter, to transfer to the file not requests, but already server's responses about executed order.
I just did not think in this direction.
The essence of this example is to show that the profit depends on the money put on the forecast, in more complex cases will be the same (just did not want to load the article with a large number of examples proving the same thing).
It will be the same only if you adapt MT4 trading processes to MT5, otherwise in certain situations there may be differences (and quite significant).
There will be only two examples: "flipping" and "trimming" (if they are written compactly enough, they will not take up much space).
And I am sure that it is the flips and truncations that are the most "tricky" and complicated aspects of such systems.
Urain:
Regarding libraries, I am not against ex5 libraries, but I don't want to use dlls because it discourages the end user.
And really, who wants to get a trojan along with the purchase. MQ tries to stick to security in its policy.
So I'm just adding to their image, as long as there is no dll, the code is safe.
As for ex5 libraries, I agree (it may be a good solution to create a specialised class library), but there is one big "but" - The functionality of solutions based only on MQL5 is sharply inferior to all the possibilities that DLL will provide.
And the issue with DLL is easier to solve than it seems to many people, there are two options:
1. Publish the source code of the library;
2. Provide the source code to MQ so that they checked them, compiled the library and put it out for public access.
PS
I would also consider synchronising the balance information of the two platforms (if possible, of course).
The same will be true only if you adapt MT4 trading processes to MT5, otherwise in certain situations there may be differences (and quite significant ones at that).
There will be only two examples: "flip" and "cut" (if they are written in a compact enough way, they will not take up much space).
And I am sure that it is flips and truncations that are the most "tricky" and complicated aspects of such systems.
As for ex5 libraries, I agree (it may be a good solution to create a specialised class library), but there is one big "but" - The functionality of solutions based only on MQL5 is sharply inferior to all the possibilities that DLL will provide.
And the issue with DLL is easier to solve than it seems to many people, there are two options:
1. Publish the source code of the library;
2. Provide the source code to MQ so that they checked them, compiled the library and put it out for public access.
PS
I would also consider synchronising the balance sheet information of the two platforms (if possible of course).
There will be no difference neither at rollover nor at cutting, the difference appears only on the difference of quote levels at the current moment and execution lag.
Ideally, if the quotes between MTs are equal and the lag is 0, the trade will bring the same profit.
You understand the main point, profit is made by betting. If you at the same moments, on both terminals, on the same quotes hold the same bet you will get the same profit.
On the dll, it is unlikely that MQ will dig into every third-party code checking its safety, and compilers delphi or srp not everyone has. You can post the code of one bible and substitute the compiled file with another one. So for now only ex5.
Interesting idea, everything that goes to the server will definitely be displayed in OnTrade(). But it is only necessary to filter, to transfer to the file not requests, but the server's responses about the executed order.
I just did not think in this direction.
Indeed, OnTrade is an ideal place for processing changes in the list of positions. You just need to initialise it so that existing trades are copied immediately at startup (and not at the next trade event).
Filtering events is very simple - check the list of positions, and continue processing only if something has changed in it.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
New article How to Copy Trading from MetaTrader 5 to MetaTrader 4 is published:
Author: Николай