Hi,
I have created MqlBookInfo book_array , I use the entire array since this is used by default . I then use MarketBookAdd within onInit() function with my CustomSymbolCreate symbol.
Finally I use the CustomBookAdd to update the MqlBookInfo book_array , then check the book_array elements to ensure book_array[counter + i].volume_real and .price values are correct.
if( CustomBookAdd(GLOBAL_custom_symbol,book_array) != -1){ Print(" Book: " + GLOBAL_custom_symbol + " updated successfully with tick: " + IntegerToString(Depth) ); Print(" Book Size: " + ArraySize(book_array) + " Ask [0] " + book_array[0].price + " Q [0] " + book_array[0].volume_real ); Print(" Book Size: " + ArraySize(book_array) + " Ask [1] " + book_array[1].price + " Q [0] " + book_array[1].volume_real ); Print(" Book Size: " + ArraySize(book_array) + " Ask [2] " + book_array[2].price + " Q [0] " + book_array[2].volume_real ); Print(" Book Size: " + ArraySize(book_array) + " Ask [3] " + book_array[3].price + " Q [0] " + book_array[3].volume_real ); Print(" Book Size: " + ArraySize(book_array) + " Ask [4] " + book_array[4].price + " Q [0] " + book_array[4].volume_real ); Print(" Book Size: " + ArraySize(book_array) + " Bid [5] " + book_array[5].price + " Q [0] " + book_array[5].volume_real ); Print(" Book Size: " + ArraySize(book_array) + " Bid [6] " + book_array[6].price + " Q [0] " + book_array[6].volume_real ); Print(" Book Size: " + ArraySize(book_array) + " Bid [7] " + book_array[7].price + " Q [0] " + book_array[7].volume_real ); Print(" Book Size: " + ArraySize(book_array) + " Bid [8] " + book_array[8].price + " Q [0] " + book_array[8].volume_real ); Print(" Book Size: " + ArraySize(book_array) + " Bid [9] " + book_array[9].price + " Q [0] " + book_array[9].volume_real ); Print("SYMBOL_TICKS_BOOKDEPTH" + SymbolInfoInteger(GLOBAL_custom_symbol,SYMBOL_TICKS_BOOKDEPTH) ); Print("SYMBOL_POINT" + SymbolInfoDouble(GLOBAL_custom_symbol,SYMBOL_POINT) ); return(true); }else{ Alert(" Book: " + GLOBAL_custom_symbol + " update failed: " + IntegerToString( GetLastError() ) ); ResetLastError(); return(false); }
My issue now, is that the Depth of Market (DOM) is still waiting for updates. The return value is not -1 , therefore I can Print out the data in the experts Tab as the image shows. What did I overlook?
Is it mandatory to use the CustomTicksAdd to trigger the DOM?
"When throwing the Depth of Market in, the symbol's Bid and Ask prices are not updated. You should control the change of the best pricesand throw in the ticks using CustomTicksAdd."

- www.mql5.com
Hi,
I have created MqlBookInfo book_array , I use the entire array since this is used by default . I then use MarketBookAdd within onInit() function with my CustomSymbolCreate symbol.
Finally I use the CustomBookAdd to update the MqlBookInfo book_array , then check the book_array elements to ensure book_array[counter + i].volume_real and .price values are correct.
My issue now, is that the Depth of Market (DOM) is still waiting for updates. The return value is not -1 , therefore I can Print out the data in the experts Tab as the image shows. What did I overlook?
Did you enable the DOM ? Documentation :
The CustomBookAdd function works only for custom symbols the Depth of Market is opened for — via the platform interface or the MarketBookAdd function.
Did you enable the DOM ? Documentation :
Yes Sir. I have the DOM open with the correct CustomSymbol attached to that opened DOM.
I have also tried the MarketBookAdd within the OnInit() without any returned value checking. I changed the code to and I have successfully triggered the MarketBoodAdd successfully
if( MarketBookAdd(GLOBAL_custom_symbol) ) { Print(" DOM SUCCESSFULLY OPENED ON:" + GLOBAL_custom_symbol); }else{ Print(" DOM FAILED ON:" + GLOBAL_custom_symbol); }
Finally I have a plotting of values within the DOM.
Now, Issue #1 is that the DOM displays the book_array[i].volume_real as a value of 0.000000x Volume ( Yes double value is correct), instead of the proper values being printed in the image ( these printed values are 0.01 at smallest). Please see the previous post
book_array[rates_counter_buy + i].volume_real = NormalizeDouble(price_bid_1_q,Create_Symbol_Digits);// // VOLUME_REAL IS double

- www.mql5.com
Is this a Bug in the DOM? The Chart Comments is from an Expert Advisor that subscribes to the attached Symbol. It seems to work with CustomCharts and Normal Charts which is great to know. However, the values of the comments display correctly (It displays the values that I pass into the CustomBookAdd function from another Expert Advisor), but the DOM Quanity book[].real_volume does not show the proper values.
The next question/bug is how to make the DOM real time? At first, I thought CustomTicksAdd needed to be updated to trigger the DOM, but after adding the necessary code to generate the mqlTick database, the DOM still doesn't update. I run the CustomBookAdd before I run the CustomTicksAdd but this should matter since on the next tick update works while the DOM is still sleeping.
Is this a Bug in the DOM? The Chart Comments is from an Expert Advisor that subscribes to the attached Symbol. It seems to work with CustomCharts and Normal Charts which is great to know. However, the values of the comments display correctly (It displays the values that I pass into the CustomBookAdd function from another Expert Advisor), but the DOM Quanity book[].real_volume does not show the proper values.
Tick_FLAG issues. Below is the int value that is assigned based on the ENUM TICK_FLAG ( not documented for some reason).
TICK_FLAG_BID = (2) tick has changed a Bid price
TICK_FLAG_ASK = (4) a tick has changed an Ask price
TICK_FLAG_LAST = (8) a tick has changed the last deal price
TICK_FLAG_VOLUME = (16) a tick has changed a volume
TICK_FLAG_BUY = (32) a tick is a result of a buy deal
TICK_FLAG_SELL = (64) a tick is a result of a sell deal
Image below includes assigning the CustomTickAdd the flag of Bid and Ask, however, the time and sales comes back as type NA.
Then I try the Tick Tag Buy and Sell with the same results
You can tell what the flag is by the "Flag" number within the Print. Any help would be much appreciated.

- www.mql5.com

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi I'm trying to get data from the book with the example cited in docs. In order to write the indicator of the queue calculation (books [4] .volume = 10;) using a #property indicator_buffers 1. int CustomBookAdd (const string symbol, // const symbol name MqlBookInfo & books [] / / array with offer book element descriptions uint count = WHOLE_ARRAY // number of elements to use); Does anyone have a running model or example that writes in the graph. Abç (treasure is in your ideas) fm