Download MetaTrader 5
To add comments, please log in or register
Publish your application in the Market - 7 million potential clients will see it
sd2000sd
212
sd2000sd 2014.03.06 10:27 

I want to get the value of the best bid. EG:

if the best price of the best bid is 2000 and its volume is 5000, then I want to be able to get that 5000 value in a variable.

How can I do this?

I couldnt find anything in SymbolInfoDouble() function.

Please help.

Thanks 

Rodrigo Malacarne
Moderator
9852
Rodrigo Malacarne 2014.03.06 11:54  
sd2000sd:

I want to get the value of the best bid. EG:

if the best price of the best bid is 2000 and its volume is 5000, then I want to be able to get that 5000 value in a variable.

How can I do this?

I couldnt find anything in SymbolInfoDouble() function.

Please help.

Thanks 

You will have to combine a for loop with the MarketBookGet() function. Something like:

//--- globals
long ask_volume = 0;
long bid_volume = 0;
MqlBookInfo BookInfo[];

//--- inside OnInit()
MarketBookAdd(_Symbol);

//--- inside OnTick() or OnTimer()
MarketBookGet(_Symbol,BookInfo);
for(int i=0;i<ArraySize(BookInfo)-1;i++)
  {
   if(BookInfo[i].type != BookInfo[i+1].type)
     {
      ask_volume = BookInfo[i].volume;
      bid_volume = BookInfo[i+1].volume;
     }
  }
/
To add comments, please log in or register