Hello,
i want to catch market orders in OnBookEvent(). But all i get are limit orders of the market depth.
My Code:
//+------------------------------------------------------------------+
//| testbook.mq5 |
//+------------------------------------------------------------------+
int OnInit()
{
MarketBookAdd(_Symbol);
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
MarketBookRelease(_Symbol);
}
//+------------------------------------------------------------------+
void OnBookEvent(const string &symbol)
{
MqlBookInfo BookInfo[];
if (MarketBookGet(_Symbol,BookInfo))
{
for(int i=0;i<ArraySize(BookInfo)-1;i++)
{
if (BookInfo[i].type == BOOK_TYPE_SELL_MARKET)
Print("Market Sell Order never happens!");
if (BookInfo[i].type == BOOK_TYPE_BUY_MARKET)
Print("Market Buy Order never happens!");
Print("Price: " + DoubleToString(BookInfo[i].price, Digits()) + "; " +
"Volume: " + (string)BookInfo[i].volume_real + "; " +
"Type: " + EnumToString(BookInfo[i].type));
}
}
}
//+------------------------------------------------------------------+
This is what happens:
Metatrader5 clearly shows me market orders on the left with volume. But my expert cant see it? How do i get market orders with code?
Thank you.