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, but only in real time. This expert advisor OrderBook History Playback allows you to play back the events of the glass on the history of pre-saved archives that are created using OrderBook Recorder. The Expert Advisor is based on the OrderBook History Library, which can be integrated into any of your expert advisors or indicators. All such programs receive OnBookEvent events in the tester, which allows you to test strategies based on the volumes from the glass.
This expert Advisor does not trade, but only displays the information of the glass in the comments. For each line of the glass, the order number, the type of orders (S – for sale, B – for purchase), the price level, and the volume are displayed.
- ShowCursor-flag for switching modes: false (default) – monitoring the events of the glass online; true-shows a vertical line-cursor that can be dragged to highlight bars in the past, and if there is archived data for this time, the glass will be displayed in the comments;
- TimerPeriod – the timer period in seconds, the default is 0, which means that there is no timer and the operation is based on ticks;
- OrderBook_FileFolder – the name of the root folder where the subfolders with the glass files are located; by default, “Books” is used; each subfolder is named by the symbol name;
- OrderBook_UseCommonFiles – option to read files from the current terminal folder (false, default) or from the shared folder of all terminals (true); use the shared folder to check this and other experts in the local tester, otherwise all required archive files must be registered in the source code using the #property tester_file directive;
- OrderBook_TimeZoneCorrection-date and time correction for cases when the glass archives are read in the terminal, where the server time zone is different from the one used for recording the archives; set in seconds; for example, if the glass was saved with the server time GMT 3 and then played back on the server quotes with GMT 2, the correction should be equal to 1 hour (-3600 seconds), since at GMT 2 the times are 1 hour behind (i.e. they are less) from GMT 3;