- Información general
- Comentarios (1)
- Discusión (9)
Order Book, known also as Market Book, market depth, Level 2, - is a dynamically updated table with current volumes of orders to buy and to sell specific financial instument at price levels near Bid and Ask.
MetaTrader 5 provides the means for receiving market book from your broker in real time. The expert OrderBook Recorder records market book changes and stores them in local files for further usage in indicators and expert adviser, including testing in the tester.
The expert stores market book of the work symbol of the chart, where it's attached.
The files are created in the folder MQL5/Files/Books, where "Books" - is an adjustable name, given through a special input parameter (see below). Inside the folder another folder is created for every specific work symbol, which contains every day records in dedicated file YYYYMMDD.hob, where YYYY, MM, DD - year, month, day correspondingly. The extension "hob" stands for History of Order Book. For example, the ticker GAZP will produce the files MQL5/Files/Books/GAZP/*.hob.
The data from the files should be read by the library OrderBook History Library. In particular, this library is used for reading market books in the indicator OrderBook Cumulative Indicator and demo expert adviser OrderBook History Playback. The library is intended to embedding into your MQL programs (source codes of the programs are required).
The expert adviser shows a comment like that:
YYYY.MM.DD HH:SS N [X]
YYYY.MM.DD HH:SS - date and time of the latest processed event;
N - total number of events written by the expert into current file since its start;
X - the size of the market book in the latest event;
- FileFolder - a string with the root folder name, where to place all files with market books for all symbols (in a separate subfolder for every symbol), by default - "Books";
Attention! Current server time is stored in the files "as is", preserving offset to GMT. Reading file archives for the same account or other accounts on the same server requires no further processing. However, if the archive is transferred to a terminal, connected to a server with different time zone (offset to GMT), one should properly adjust the parameter OrderBook_TimeZoneCorrection in the library OrderBook History Library. Please note, that the tester does always emulate a server with the timezone GMT+0, regardless of actual timezone of the quotes!
To enable new format set SaveSessionInfo input parameter to true. By default, SaveSessionInfo is false, and hob-files are saved in previous format 1.1. If a hob-file of version 1.1 does already exist for current day, it will not be switched to format 1.2 automatically. If required, you may export the hob-file to CSV format by means of OrderBook Utilities and then import the CSV back to a hob with SaveSessionInfo=true.
To upgrade to 1.2 it's recommended to switch SaveSessionInfo on between the days, when a hob-file for new day is not yet created.
It's not necessary to convert all historical hob-files to format 1.2, both formats are supported in parallel.
This version of the product supports new structure format, but it will not work on older builds.