Download MetaTrader 5

Can't use market depth in EA anymore

To add comments, please log in or register
Find out how to install MetaTrader on Mac OS
arcull
121
arcull 2015.08.19 21:49 

Hi there,

for quite a while I was using market depth info in my EA on a demo account. Suddenly (maybe an update of MT5 platform) I can't anymore, unless it's window is manually opened in the MT5. The code to get the market depth goes like

MqlBookInfo priceArray[];
bool getBook=MarketBookGet(Symbol(),priceArray);

if(getBook) {

  // here goes the code to process it

} else {

  // now always going here

}

Do you have any idea why is this so? How could I solve it? I don't want to open that MD window always, just for my EA to work. Much thanks.

Alain Verleyen
Moderator
30737
Alain Verleyen 2015.08.19 22:16  

Please read the documentation of MarketBookGet().

Note

The Depth of Market must be pre-opened by the MarketBookAdd() function.

arcull
121
arcull 2015.08.19 22:32  
Yes you're right, don't know how it worked till now ;), thanks
To add comments, please log in or register