Discussion of article "Bi-Directional Trading and Hedging of Positions in MetaTrader 5 Using the HedgeTerminal Panel, Part 1"

 

New article Bi-Directional Trading and Hedging of Positions in MetaTrader 5 Using the HedgeTerminal Panel, Part 1 has been published:

This article describes a new approach to hedging of positions and draws the line in the debates between users of MetaTrader 4 and MetaTrader 5 about this matter. The algorithms making such hedging reliable are described in layman's terms and illustrated with simple charts and diagrams. This article is dedicated to the new panel HedgeTerminal, which is essentially a fully featured trading terminal within MetaTrader 5. Using HedgeTerminal and the virtualization of the trade it offers, positions can be managed in the way similar to MetaTrader 4.

Within the last 18 months MetaQuotes have conducted extensive work on consolidating the MetaTrader 4 and MetaTrader 5 platforms into a unified trading ecosystem. Now both platforms share a common market of program solutions - Market, offering different products from external developers. The compilers for both platforms were united as well. As a result both platforms have a common compiler based on MQL5 and one programming language - MQL with a different function set depending on the platform in use. All publicly available source codes located in the Code Base were also revised and some of them were adjusted to be compatible with the new compiler.

This major unification of the platforms left aside the unification of their trading parts. The trading models of MetaTrader 4 and MetaTrader 5 are still fundamentally incompatible despite the fact that the major part of the trading environment is shared. MetaTrader 4 facilitates individual management of trading positions through the system of orders - special program entities making the bi-directional trading in this terminal simple and easy. MetaTrader 5 is intended for the exchange trade where the main representation of a trader's obligations is their aggregate net position. Orders in MetaTrader 5 are simply instructions to buy or sell a financial instrument.

The difference between the trading performance of these two platforms caused a lot of heated discussions and debates. However, discussions remained discussions. Unfortunately, since the release of MetaTrader 5, not a single working solution was published that could enable presenting a trader's obligations as bi-directed positions like in MetaTrader 4. Although numerous published articles suggest various solutions, they are not flexible enough to be conveniently used on a large scale. In addition, none of those decisions are suitable for the exchange trading, which involves a lot of nuances that have to be taken into consideration.

This article should settle the controversies between the fans of the fourth and the fifth versions of the MetaTrader platform. This is going to provide a universal solution in the form of thorough program specification and the exact program solution implemented by this specification. This article discusses a visual panel and the virtualization library HedgeTerminal, which enable presenting a trader's obligation as bi-directional positions like in MetaTrader 4. At the same time, the model underlying HedgeTerminal takes into account the character of the trading orders execution. That means that it can be successfully implemented both at the over-the-counter market FOREX and centralized exchanges like, for example, trading derivative securities in the derivatives section of Moscow Exchange.

On the whole, formation of the exchange price is more complex and contains a lot of significant details hidden when trading Forex and in the MetaTrader 4 terminal.

There are other situations when extended representation of the trading environment in MetaTrader 5 requires additional efforts to analyze this information. That prompts logical questions:

Is there a way of making the trading process in MetaTrader 5 as simple and clear as in MetaTrader 4 and keep a convenient access to all required trade details? If there is a way to arrange bi-directional exchange trading using MetaTrader 5 the same simple way as MetaTrader 4? - The answer to those questions is: "Yes, there is"!

Let us refer to the diagram of capabilities of the MetaTrader 4 and MetaTrader 5 terminals to understand how this is possible:

Fig. 1 Capabilities of MetaTrader 4 and MetaTrader 5

Fig. 1 Capabilities of MetaTrader 4 and MetaTrader 5

Author: Vasiliy Sokolov

 

The previous speaker [pseudo-expert] forgot to write (as always) that this is his imho, which has a distant relation to reality.... The classic "who are the judges?" comes to mind.

Vasily, well done! I think it's such a read.... in the best sense

[Deleted]  
I haven't read the article yet, although I was waiting for it, as I know what it will be about.

For some reason I can't agree with the Euler-Venn diagram above.

On the one hand, the developers have always cited net-MT5 as a market advantage over the kitchen MT4. And now Vasily proposes to make a Frankenstein-MT5 out of net-MT5 by MQL forces, disregarding the developers' opinion that the TS with multidirectional positions is an unspeakable nonsense.

This Vasily is such an instigator of democratic market values! Everyone is pulled out of the noose, shown how to do it, and he twists and turns and agitates for the noose again.

I will read it, in case the rope comes in handy.

And seriously, I don't know of any exchange platform that has an inexpensive, simple and ready-made virtualisation toolkit. And Vasily's work, in my opinion, stands apart as the affordable and only functioning bicycle. That's why MT5 is probably the only exchange platform that can now put a plus in the "virtualisation" item, albeit a paid (symbolically), but still a plus.

ZЫ The diagram is very dubious, however... it would not hurt the author to explain what he meant when he drew it.
 

The abundance of pictures with supposedly English text is something -- a perfect example of showing off to potential readers.

It should have been written in the first lines of the article, or in the first comment to the article, to say that the article is not for everyone. Especially since there are already such precedents in the "Articles" service, when the author with full self-awareness, directly and with "respect"for the readers writes:"this article is not for [such] people. The focus is not on them". [..]

I realise that the author provides super-valuable information (which can be dispensed with in case of developed MT4, and, in general, can be dispensed with without MT4) and, say, those who want to get it should poke around in dictionaries. But you should at least a little bit of your own cleverness to include: how to put the abundant text from pictures into an online translator?

p.s. On the subject of the article, without regard to this poly-lingual article, the subject deserves attention.

 
abolk:

Regarding pictures with English text:

Well firstly, most of the screenshots are screenshots of the panel itself. It is naturally localised for English by default, as it is presented on an international resource where not everyone knows Russian. Besides, it is a requirement of AppStore: all screenshots must be made in English, and the interface must be in English as well. I couldn't describe the localised version of HT in the article, as it would differ from the default version and would confuse many users.

Secondly, since half of the screenshots should be in English, the other half should also be in English. Otherwise, the general style would be broken and we would get an even bigger language vinaigrette.

Thirdly, the second half of the screenshots are simple schemes. Many of them include words like "Order" or "Magic". - These are such well-established concepts that translating them, by contrast, would not be desirable.

Fourth, each illustration is described in detail in the text. Rather, the illustration serves as a supplement to the description, not the other way round. Therefore, it is possible to understand the meaning of the figure without understanding the text within it. Drawings are made rather for beginners. People with more or less understanding of the problematic will understand the material without a single figure.

Fifthly, these schemes in English are supposed to be used also for communication with foreigners. For example, I recently had to explain the scheme of HT installation to an Australian, figure #12 helped a lot and removed all questions at once.

Figure #12 stands out. This is a really complicated figure. I think it is really necessary to present a localised version of it.

Finally, for those who prefer to see their native language instead of English, HT has a localisation option. You can change the column names to similar Russian words (see section 2.10 Changing the appearance of HedgeTerminal tables).

 
C-4:

In Leo Tolstoy's novel "War and Peace", by the way, a novel of world fame -- there is a lot of text in French. For such cases, there are commentaries that provide a full translation of the original text into the language of publication.

It's just a rule of good manners.

By the way, the resource mql5.com -- international -- but the creators of the resource did not allow themselves to arrange a poly-lingual mishmash. You can select the "English" language on the resource and you will get to the English branch of the forum and not to any other.

As for me, having seen the abundance of presumably English text without translation, I decided not to read your article at all -- although I am not uninterested in the subject of the article. But you are not the only author of such studies. Right?

 

zaskok:

...

On the one hand, the developers have always cited net-MT5 as a market advantage over the kitchen MT4. And now Vasily proposes to make net-MT5 a Frankenstein-MT5 by MQL forces, disregarding the developers' opinion that the TS with multidirectional positions is unspeakable nonsense.
....

Never any such assertions were made by the developers. It's just that the net view is the de facto standard in the exchange industry.

zaskok:
...
And seriously, I don't know of any exchange platform that has an inexpensive, simple and out-of-the-box virtualisation toolkit. And Vasily's work, in my opinion, stands apart as an affordable and the only functioning bicycle. Therefore, MT5 is probably the only exchange platform that can now put, albeit paid (symbolically), but still a plus in the item "virtualisation".
....

I know at least three platforms where virtualisation is built in by default. For example, ducascopy terminal. There is also the stock exchange WealthLab and the same stock exchange but not public super-HFT platform TradeWorkShop. In other words, multidirectional trading is not only the prerogative of MT4. Multidirectional trading is also possible in the exchange environment, which means that it is possible in MetaTrader 5 as well. Hence the answer to your question:

zaskok:
ZЫ The diagram is very doubtful, however.... the author should explain what he meant when he drew it.

The net representation does not impose restrictions on multidirectional trading, because by definition it follows from Figure 1 that the net representation is on the outer contour of opportunities.

H.Y. The diagram is not mine by the way, but was drawn and posted by Renat, and I only integrated it into the general context of the described material.

[Deleted]  
C-4:

No such assertions were ever made by the developers. It's just that net representation is the de facto standard in the exchange industry.

I looked at your profile. You're not new. Why are you lying? I never thought before that only Renat was and is pouring mud on multidirectional positions among developers, and the rest of them kept silent and continue to keep silent. They do not speak out on this topic at all. The head of the same always climbed always quite hard to the ambuscade, not forgetting about the Mauser in the form of a ban ... You must have forgotten.

I know at least three platforms where virtualisation is built in by default. For example, the ducascopy terminal.

It is not a stock exchange terminal. In FOREX, yes, there are plenty of modern MT competitors that support virtualisation by default, including API.

There is also a stock exchange WealthLab and the same stock exchange, but not public super-HFT platform TradeWorkShop. In other words, multidirectional trading is not just a prerogative of MT4.

I didn't know about the virtualisation capabilities of WealthLab. Thank you!

Multidirectional trading is possible in the exchange environment, and therefore it is possible in MetaTrader 5. Hence the answer to your question:

Multidirectional trading is always an element of virtualisation. FOREX is also netting. And MT4 has its own virtualisation mechanism not because of FOREX peculiarities. There are so many breeches written MT4 <-> FOREX FIX API Netto.

Netto representation does not impose restrictions on multidirectional trading, because by definition it follows from Figure 1 that netto representation is on the outer loop of possibilities.

H.Y. The diagram is not mine by the way, but was drawn and posted by Renat, and I only integrated it into the general context of the described material.

Virtualisation is implemented on MT5, but it is also net implemented on MT4. So why does the net feature set contain MT4? MT4 is just as much a net platform as MT5. The reverse is also true: MT5 has a virtualisation mechanism just like MT4. So the digram sets must either coincide or overlap. But in no way contain someone completely.

About the article - I haven't read 10% of it yet. But I have a desire to see Moving Averages Expert Advisor written on HT API. After that, to make performance measurements in the tester of the original and its HT-thesis. And to have thousands of trades, orders and positions. I.e. I want to understand the speed costs of virtualisation. Can you share this?

 
I don't understand why it's so complicated, hedge trading has simple principles. Redeem points in time, and don't forget about the bubble expansion.
 
zaskok:

I looked at your profile. You're not new. Why are you lying? I never thought before that only Renat poured mud on differently directed positions of developers, and the rest of them kept silent and continue to keep silent. They do not speak out on this topic at all. The head of the same always climbed always quite hard to the ambuscade, not forgetting about the Mauser in the form of a ban ... You must have forgotten.

I'm not being deceitful, you're just referring inaccurately. There were conversations. But not in the sense that net is true and multidirectional trading is bad. There were claims that portfolios of strategies are evil, and you really only need one strategy on one account. I do not share this opinion. Moreover, there are serious works proving the effectiveness of portfolios. The main one, of course, is Markowitz's work.

zaskok:

Multidirectional trading is always an element of virtualisation. FOREX is also netting. And MT4 has its own virtualisation mechanism not because of FOREX peculiarities. There are so many breeches written MT4 <-> FOREX FIX API Netto.

Exactly. Multidirectional trading is always virtualisation and I have written about it in the second part of the article. Basically the only difference is whether virtualisation takes place at the server level or at the user level.

zaskok:

Virtualisation is implemented on MT5, but net is also implemented on MT4. So why is it that MT4 contains net many features? MT4 is just as much a net platform as MT5. The reverse is also true: MT5 has a virtualisation mechanism just like MT4. So the digrams should either match or overlap. But in no way contain someone completely.

O.k. I admit: netting and virtualisation are equivalent concepts. I'm not an MT5 developer. I don't need to prove that version 5 is better than 4. The identity between netting and what is in MetaTrader 4 is enough for me.

I argue that netting does not impose restrictions on virtualisation and with a developed user programming language, reliable and guaranteed* virtualisation is possible on the user side, without involving the server side.

*An important remark, I cannot guarantee that there are no software bugs in HT that could potentially break the integrity of the representation. In any case, these bugs will be fixed when discovered, and the bug content of HT will be reduced to zero over time.

zaskok:

Virtualisation is implemented on MT5, but net is also implemented on MT4. So why does the net feature set contain MT4? MT4 is just as much a net platform as MT5. The reverse is also true: MT5 has a virtualisation mechanism just like MT4. So the digrams should either match or overlap. But in no way contain someone completely.

Don't worry about these diagrams. Just consider that there are some chips in MT5, which are not and will not be in MT4. For example, MT5 has the Russian stock market, while MT4 does not.
 
zaskok:

On the article - I haven't read 10% of it yet. But there was a desire to see Moving Averages Expert Advisor written on HT API. After that I would like to measure the performance in the tester of the original and its HT-thesis. And to have thousands of trades, orders and positions. I.e. I want to understand the speed costs of virtualisation. Can you share such a tool?

Yes, there is such an Expert Advisor. But its implementation was considered not quite successful, because it was done hastily and used OOP (for beginners it is not good).

A serious performance test was not performed, but there should not be a big difference. The main resource-intensive operations are: file read-write operations (the notorious local loop) and retrospective trading with deployment of positions in memory. During testing we managed to completely get rid of the local loop (and hence file operations), as the monopoly mode is used in the test mode. One Expert Advisor is launched, for which a trading environment is created; there is no need to exchange with other instances.

Deployment in a folder is also not required, because when the Expert Advisor is launched, the test account is empty: there are no deals or orders.

During testing, one order generates one deal (i.e. vice versa, but it doesn't matter). This is also a significant acceleration, because the "order arithmetic" is significantly simplified. Also in this case, the order is searched once. I.e. the search operation (which between us is O(log2(n))) is performed once.

In general, I attach the HedgeMA Expert Advisor. Look, test, study. But in order to compare speeds, we should modify the Expert Advisor in such a way that the same code could work both with HT and in MT5 net-environment.

Z.Y. Wait for the second part. It is about API. There are nuances, you should know them before studying performance.

Files:
This website uses cookies. Learn more about our Cookies Policy.