depth of market (DOM) - WhooDoo22 - page 4

 
PCWalker:

Why I can't see the volume of the Market Depth on the table window?

Thank you. 

Hi, PCWalker, I don't know which code you're using, however, if you're trying to get the best bid & ask volumes, you could try this code:

//--- 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;
     }
  }

 I hope it helps.

 
Malacarne:

Hi, PCWalker, I don't know which code you're using, however, if you're trying to get the best bid & ask volumes, you could try this code:

 I hope it helps.

And this will add the volume to the Depth Market window?
 
PCWalker:
And this will add the volume to the Depth Market window?
This will retrieve the volumes. If you're not able to see the volume when you open the DOM, then it's highly probable that your broker doesn't provide this information.
 
Malacarne:
This will retrieve the volumes. If you're not able to see the volume when you open the DOM, then it's highly probable that your broker doesn't provide this information.

So, I would need to insert the code where exactly?

 
PCWalker:

So, I would need to insert the code where exactly?

Inside any indicator or expert advisor. However, if your interest is only to "see" the volumes, then it depends on your broker to provide this information.
 
Malacarne:
Inside any indicator or expert advisor. However, if your interest is only to "see" the volumes, then it depends on your broker to provide this information.
Thank you.
 
Malacarne:

Hi, PCWalker, I don't know which code you're using, however, if you're trying to get the best bid & ask volumes, you could try this code:

 I hope it helps.

When I run the EA, I get a single line. I expected an ARRAY of values, showing the entire 'book'. I'm using "A..." broker, so I'm seeing many levels, each with it's own volume.

Am I missing something? The code appears to me to be ARRAY based and the 'i' variable I would think would produce multiple lines in the Experts tab representing ALL the 'DOM' levels FOR EACH TICK,

not just one per tick.

Any thoughts?


Thanks,

Merlin

 
MerlinBrasil:

When I run the EA, I get a single line. I expected an ARRAY of values, showing the entire 'book'. I'm using "A..." broker, so I'm seeing many levels, each with it's own volume.

Am I missing something? The code appears to me to be ARRAY based and the 'i' variable I would think would produce multiple lines in the Experts tab representing ALL the 'DOM' levels FOR EACH TICK,

not just one per tick.

Any thoughts?


Thanks,

Merlin

Hi Merlin,
Maybe you could show us what you've so far?
 
Malacarne:
Hi Merlin,
Maybe you could show us what you've so far?

Hi MC,

I was just using, and referring to, the EA code on Page 1 of this thread. I hate re-inventing the wheel ;)

 
MerlinBrasil:

Hi MC,

I was just using, and referring to, the EA code on Page 1 of this thread. I hate re-inventing the wheel ;)

Well, the code is intended to retrieve only the best bid and ask volumes, and not the whole DOM volumes. Maybe that's why you're getting only "a single line" of information. So I think you're maybe "missing something", and you have to "re-invent the wheel" a little bit to get what you're expecting... ;-)
Reason: