Download MetaTrader 5

Discussion of article "MQL5 Cookbook: Handling BookEvent"

To add comments, please log in or register
MetaQuotes Software Corp.
Moderator
182382
MetaQuotes Software Corp. 2014.10.22 13:18 

New article MQL5 Cookbook: Handling BookEvent has been published:

This article considers BookEvent - a Depth of Market event, and the principle of its processing. An MQL program, handling states of Depth of Market, serves as an example. It is written using the object-oriented approach. Results of handling are displayed on the screen as a panel and Depth of Market levels.

As is well known, the MetaTrader 5 trading terminal is a multi-market platform, that facilitates trading on Forex, stock markets, Futures and Contracts for Difference. According to the Freelance section stats, the number of traders trading not only on Forex market is growing.

In this article I would like to introduce novice MQL5 programmers to the BookEvent handling. This event is connected with Depth of Market—an instrument for trading stock assets and their derivatives. Forex traders, however, may find Depth of Market useful too. In ECN accounts, liquidity providers supply data on the orders, though only within their aggregator model. These accounts are becoming more popular.


1. BookEvent

According to the Documentation, this event is generated when Depth of Market status changes. Let us agree that BookEvent is a Depth of Market event.

Depth of Market is an array of orders, which differ in direction (sell and buy), price and volume. Prices in Depth of Market are close to the market ones and therefore are considered as the best.

Fig.1 Depth of Market in MetaTrader 5

Fig.1 Depth of Market in MetaTrader 5

In MetaTrader 5 an "order book" is named as the "Depth of Market" (Fig.1). Detailed information about Depth of Market can be found in the User Guide to the Client Terminal.


Author: Dennis Kirichenko

Alain Verleyen
Moderator
31085
Alain Verleyen 2014.10.25 12:31  

Just for information, there is a little error in this article :

All programs working with Depth of Market data will have a form of an Expert Advisor, as only Expert Advisors feature the event handler of BookEvent. There is a possibility, however, to write an "Expert-Indicator" pair , where the indicator can receive data from the EA and process the Depth of Market state.

It's not true, indicators can also process BookEvent. This error is based on a documentation's error and should be corrected soon. The article's author and ServiceDesk have been contacted.

BlackBart
711
BlackBart 2015.06.01 17:16  
Is it possible create a book event for forex market to see the pending orders? Naturally for a single liquidity provider.
Alain Verleyen
Moderator
31085
Alain Verleyen 2015.06.01 20:09  
BlackBart:
Is it possible create a book event for forex market to see the pending orders? Naturally for a single liquidity provider.
You need a broker which provides these informations.
To add comments, please log in or register