depth of market (DOM) - WhooDoo22

 

Hello MQL5 community,

I'm attempting to write an EA witch will place trades based on depth of market. I read a thread earlier https://www.mql5.com/en/forum/6382 and noticed admin Rosh mentioned depth of market must be available for the currency pair of the broker in order to use this feature within an EA (something along the lines of that). Does the downloadable MT5 provide depth of market (DOM) for EURUSD instrument? I'm guessing coders/traders have been down this road before me such as https://www.mql5.com/en/market/product/663 and I am curious if anyone can provide any advice as to complete this task. I've been reading the MQL5 reference and noticed three particular functions as shown in the snapshot below-

MQL5 refference snapshot

I wish to code an EA to check the present depth of market (this means the current shift of zero, shift [0]). I may also code an indicator in the future displaying DOM and implicate it into the EA but that is the future and now is the EA.


Thank you

Metatrader 5 Market Depth
Metatrader 5 Market Depth
  • www.mql5.com
I'm new to metatrader 5 and MQL I was wondering if someone knew what was necesary to do in order to be able to use Market depth information?
 
WhooDoo22:

Hello MQL5 community,

I'm attempting to write an EA witch will place trades based on depth of market. I read a thread earlier https://www.mql5.com/en/forum/6382 and noticed admin Rosh mentioned depth of market must be available for the currency pair of the broker in order to use this feature within an EA (something along the lines of that). Does the downloadable MT5 provide depth of market (DOM) for EURUSD instrument? 

It depends on the Broker you select  https://www.mql5.com/en/forum/10009
 
RaptorUK:
It depends on the Broker you select  https://www.mql5.com/en/forum/10009

No way, its Simon. Glad to read your response! It seems you've found your way to MQL5 and I'm very glad you did. I'm sure you've figured out by now why I'm learning MQL5 ;)


Thank you

 
click "View" menu on MT5 then hover over "Depth of Market" and you will see what available. It vary from one broker to another, so you may have to add new broker to your MT5.
 
phi.nuts:
click "View" menu on MT5 then hover over "Depth of Market" and you will see what available. It vary from one broker to another, so you may have to add new broker to your MT5.

phi.nuts posts as well. Its practically a reunion ;) I've posted another snapshot of my actions following your instructions.

I don't understand what these presented values mean. Could you possibly explain these values please phi.nuts?

dom snapshot


Thank you

 
WhooDoo22:

phi.nuts posts as well. Its practically a reunion ;) I've posted another snapshot of my actions following your instructions.

I don't understand what these presented values mean. Could you possibly explain these values please phi.nuts?

Thank you

GBOT, if I'm not mistaken (again), that will be Global Board of Trade that trade futures.

Try to open another broker server in your MT5.  Just open new account, and in "Open an Account" window, scroll down till you find "add new server ..." and then click on it and type in name of broker, for example Alpari UK.

 

 
phi.nuts:

GBOT, if I'm not mistaken (again), that will be Global Board of Trade that trade futures.

Try to open another broker server in your MT5.  Just open new account, and in "Open an Account" window, scroll down till you find "add new server ..." and then click on it and type in name of broker, for example Alpari UK.

 

Understood, I'll give it a shot.


Thank you

 

Phi.nuts,

I opened a demo account on a different broker's server and the results are as follows-

DOM result

Notice how the "Depth Of Market" tab is faded. I'm guessing this server doesn't provide DOM. Also,

DOM EA journal result

and of course I attached the EA below for visual aid.

//+------------------------------------------------------------------+
//|                                                       DOM EA.mq5 |
//|                        Copyright 2012, MetaQuotes Software Corp. |
//|                                              http://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2012, MetaQuotes Software Corp."
#property link      "http://www.mql5.com"
#property version   "1.00"
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
   
//---
   return(0);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---
   
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {


   MqlBookInfo priceArray[];
   bool getBook=MarketBookGet(NULL,priceArray);
   if(getBook)
     {
      int size=ArraySize(priceArray);
      Print("MarketBookInfo for ",Symbol());
      for(int i=0;i<size;i++)
        {
         Print(i+":",priceArray[i].price
               +"    Volume = "+priceArray[i].volume,
               " type = ",priceArray[i].type);
        }
     }
   else
     {
      Print("Could not get contents of the symbol DOM ",Symbol());
     }
   
  }
//+------------------------------------------------------------------+

The EA basically only contains code from an example contained within MarketBookGet from the MQL5 reference.

Is it usual for brokers to not show DOM on demo account servers and only show DOM on real account servers?


Thank you

Files:
DOM_EA.mq5  2 kb
 
WhooDoo22:

Phi.nuts,

I opened a demo account on a different broker's server and the results are as follows-


Notice how the "Depth Of Market" tab is faded. I'm guessing this server doesn't provide DOM. Also,


and of course I attached the EA below for visual aid.

The EA basically only contains code from an example contained within MarketBookGet from the MQL5 reference.

Is it usual for brokers to not show DOM on demo account servers and only show DOM on real account servers?


Thank you

Its really is depend on broker whether they provide DOM data in its demo or live.

Here's mine with Alpari UK demo.

 

     

  
 

Hello WhooDoo22,

As I tell you on mql4 forum, Depth of Market for forex is not very usable if available at all. No central market here. At best, like phi.nuts show you, it depends on broker, and it is depth of market for ONE broker only, not for the FOREX market as a whole.

I don't think you can elaborate a winning strategy with Depth of Market for forex. But may be I am wrong !

 
phi.nuts:

Its really is depend on broker whether they provide DOM data in its demo or live.

Here's mine with Alpari UK demo.

 

     

  

Ah, interesting.


Thank you kindly