Download MetaTrader 5

Can't use market depth in EA anymore

To add comments, please log in or register
arcull
150
arcull  

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
32520
Alain Verleyen  

Please read the documentation of MarketBookGet().

Note

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

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