Login / Register
Add a review
Log in
Sign UP
[bws_google_captcha]

Order Book, also known as Market Book, market depth, price glass, Level 2 , is a dynamically updated table provided by the broker with data on the current volumes of trading orders for buying and selling for various price levels near the Bid and Ask of a particular financial instrument.

MetaTrader 5 provides the ability to broadcast the price glass in real time. This expert advisor OrderBook Recorder allows you to record all the events about the change of the glass and save them to files for further use in indicators and experts, including in the tester.

The Expert Advisor saves the glass of the working symbol of the chart on which it is placed.

The files are created in the MQL5/Files/Books folder of the terminal, with “Books” being a custom name set by the input parameter (see below). Inside, a separate folder is created for each character, and each day is saved in a separate file named YYYYMMDD. hob, where YYYY, MM, DD are the year, month, and date, respectively. The hob – History of Order Book extension. For example, for the GAZP ticker, we get the MQL5 files/Files/Books/GAZP/*.hob.

To read glass data from files, you must use the OrderBook History Library. This library, in particular, is used for reading the glass by the OrderBook Cumulative Indicator and the OrderBook History Playback demo expert.

[spoiler title=”Read More…”]

In the process, the expert Advisor displays a comment like:

where YYYY.MM.DD HH:SS – date and time of the last processed event;

N – the total number of events recorded by the expert in the current file since its launch;

X – the size of the cup in the last event;

  • FileFolder-a string with the name of the root folder where all the cup files for all characters will be stored, by default- ” Books”;

Attention! The files store the current server time, taking into account the offset relative to GMT. Reading the archive for the same account and other accounts of the same server does not require additional settings. However, if the archive will be moved to a terminal connected to the server with a different time offset relative to GMT, you must use the OrderBook_TimeZoneCorrection parameter in the OrderBook History Library. Keep in mind that the tester always emulates a server with GMT 0, regardless of the current time of quotes!

Attention! The files store the current server time, taking into account the offset relative to GMT. Reading the archive for the same account and other accounts of the same server does not require additional settings. However, if the archive will be moved to a terminal connected to the server with a different time offset relative to GMT, you must use the OrderBook_TimeZoneCorrection parameter in the OrderBook History Library. Keep in mind that the tester always emulates a server with GMT 0, regardless of the current time of quotes!

[/spoiler]

Add review
Reviews ( 0 ):