I've been reading for a long time, but I didn't understand why?
Imho, at least to have a ready class (like Standard Library) to analyse current liquidity of an instrument.
Vasily is well done! High code level and systematic approach. Way to go!
Long read, but didn't understand why all this?
Imho, at least to have a ready class (like Standard Library) to analyse current liquidity of an instrument.
Well done Vasily! High code level and systematic approach. Way to go!
Exactly so. The task of my "MQL Recipes" is to extend the MQL Standard Library with new non-trivial classes, making the trader's work more convenient.
As for the price stack, it is critical to provide the most efficient mechanism of access to Level II data. This is the case when working through an intermediary class can be much faster (and of course more convenient) than a complete search of the stack on each OnBookEvent. The algorithms embedded in the price glass class are written for a reason.
Exactly. The task of my "MQL Recipes" is to extend the standard MQL library with new non-trivial classes, making the trader's work more convenient.
As for the price book, it is critical to provide the most efficient mechanism of access to Level II data. This is the case when working through an intermediary class can be much faster (and of course more convenient) than a complete search of the stack on each OnBookEvent. The algorithms embedded in the price glass class are written for a reason.
Mikhail, we are still waiting to learn from you in the neighbouring thread what is the direction of the last trade.
I think you also promised to write your article about how to use the event model in MetaTrader5. I would like to read it at last.
Mikhail, we are still waiting to learn from you in the neighbouring thread what is the direction of the last trade.
I think you also promised to write your article about how to use the event model in MetaTrader5. I would like to read it at last.
The article has not been published (it is small in size, unlike yours), but you can read it in my Blog.
P/S In the neighbouring thread and read about the direction...
By the way, a remark on the article.
You can't do it the way you wrote:
//+------------------------------------------------------------------+ //| BookEvent function| //+------------------------------------------------------------------+ void OnBookEvent(const string &symbol) { //--- printf("The price glass by " + symbol + " changed"); }
Because the BookEvent event is broadcast.
And as soon as you subscribe to receive it, you will receive everything in OnBookEvent(),
that you have open in the Market Watch.
That's why you need to filter the event for the selected symbol:
//+------------------------------------------------------------------+ //| BookEvent function| //+------------------------------------------------------------------+ void OnBookEvent(const string &symbol) { //--- if ( symbol == _Symbol ) { printf("The price glass by " + symbol + " changed"); } }
The article was not published (small in size, unlike yours), but you can read it in my Blog.
P/S In the neighbouring thread and read about the direction....
By the way, a remark on the article.
You can't do it the way you wrote:
Because the BookEvent event is broadcast.
And as soon as you subscribe to receive it, you will receive everything in OnBookEvent(),
that you have open in the Market Watch.
That's why you need to filter the event just for the selected symbol:
Michael, from the documentation:
Provides opening of the price book for the specified instrument, and also subscribes to receive notifications about changes in the specified book.
bool MarketBookAdd( |
I.e. the developers have introduced MarketBookAdd for the purpose that OnBookEvent would be called only when the stack of predefined symbols in MarketBookAdd changes. Thus, nothing but pre-defined symbols will get to OnBookEvent.
Read OnBookEvent()
В отличие от других событий, событие BookEvent является широковещательным. Это означает, что достаточно одному эксперту подписаться на получение события BookEvent с помощью функции MarketBookAdd, все остальные эксперты, имеющие обработчик OnBookEvent(), будут получать это событие. Поэтому необходимо анализировать имя символа, которое передается в обработчик в качестве параметра const string& symbol.
Hello,
Thanks so much for the contribution.
It is exactly what I was searching for.
Depth of Market can be a great indication for scalpers.
But the problem is I never really see depth of market volume information in my terminals.
How to get access to the volume information provided by the broker?
- 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 MQL5 Cookbook: Implementing Your Own Depth of Market has been published:
This article demonstrates how to utilize Depth of Market (DOM) programmatically and describes the operation principle of CMarketBook class, that can expand the Standard Library of MQL5 classes and offer convenient methods of using DOM.
MQL5 language is constantly evolving and offering more opportunities for operation with exchange information every year. One of such exchange data types is information about Depth of Market. It is a special table showing price levels and volumes of limit orders. MetaTrader 5 has a built-in Depth of Market for displaying limit orders, but it is not always sufficient. First of all, your Expert Advisor has to be given a simple and convenient access to Depth of Market. Certainly, MQL5 language has few special features for working with such information, but they are low-level features that require additional mathematical calculations.
However, all intermediate calculations can be avoided. All you have to do is to write a special class for working with Depth of Market. All complex calculations will be carried out within Depth of Market, and the class itself will provide convenient ways for operation with DOM prices and levels. This class will enable an easy creation of the efficient panel in a form of an indicator, which will be promptly reflecting the current state of prices in Depth of Market:
Fig. 1. Depth of Market displayed as a panel
After reading the first chapter of this article, it will become clear that the regular Depth of Market offered by MetaTrader 5 has impressive capabilities. We will not try to duplicate all these multiple opportunities in our indicator, as our task will be completely different. With a practical example of creating user-friendly Depth of Market trading panel we will show that the principles of object-oriented programming allow relatively easy handling of complex data structures. We will ensure that it won't be difficult to gain access to Depth of Market directly from your Expert Advisor with MQL5 and, consequently, to visualize its representation as it is convenient for us.
Author: Vasiliy Sokolov