My EA does a double entry - page 2

 
angevoyageur:

This seems a possible explication, but if it's the case it's not normal. Are you using asynchronous mode ? If not, your EA must wait the reply of the server and then only continue and process the next tick.

If I understand well this is a random issue and you can't reproduce it ?

You can try to print more debug info by adding this line after the declaration of m_Trade :


Hi

Since my solution described in post https://www.mql5.com/en/forum/14327 I have had 1 more double trade.

I think the problem is the (to slow) execution of the PositionSelect(Symbol()) function. Maybe, the new ticks come in so fast, the EA sends in a new order before it receives a response of the PositionSelect(Symbol()). So the current position size is not calculated properly. In my code, its theoretically impossible to send in a new/double order if the current position size is equal or greater than the max allowed position size, see code.  

The live server (ECN) of broker X generates so many ticks during a macro economic news event, for every tick you see on the simulation server of metaquotes, this server will generate 20, 30 or 40 ticks!  


PositionSelect(Symbol());

// Check of het model al LONG zit.             
if(PositionGetInteger(POSITION_TYPE) == POSITION_TYPE_BUY)
      {
                                                           
// Check of het model al de maximale size in positie zit.                     
      if(PositionGetDouble(POSITION_VOLUME) >= MAX_Trade_Size)
            {
            return;
            }
      } 


My EA automatically reverses the double position to obtain the correct position size as an additional backup.

Problem: Multiple Trades at brokerX
Problem: Multiple Trades at brokerX
  • www.mql5.com
Problem: Multiple Trades at brokerX.
 
snelle_moda:
....

The live server (ECN) of broker X generates so many ticks during a macro economic news event, for every tick you see on the simulation server of metaquotes, this server will generate 20, 30 or 40 ticks!  

Yes this is because the DOM is active.

....

My EA automatically reverses the double position to obtain the correct position size as an additional backup.

Thank you for your input. Do you have this problem on the same broker as others, or is it broker independent ?
 
angevoyageur:
Yes this is because the DOM is active.
Thank you for your input. Do you have this problem on the same broker as others, or is it broker independent ?


What is "DOM"???


Only on this broker server, I have never experienced it on the simulation (Metaquotes) server since this thread https://www.mql5.com/en/forum/14327 was started.

Before that period, the server of broker X generate approximately an equal amount of ticks as the Metaquotes server. 

Problem: Multiple Trades at brokerX
Problem: Multiple Trades at brokerX
  • www.mql5.com
Problem: Multiple Trades at brokerX.
 
snelle_moda:


What is "DOM"???


Only on this broker server, I have never experienced it on the simulation server since this thread https://www.mql5.com/en/forum/14327 was started.

Before that period, the server of broker X generate approximately an equal amount of ticks as the Metaquotes server. 

DOM = Depth of Market, when it's activated there is a lot more Tick events.
 
angevoyageur:
DOM = Depth of Market, when it's activated there is a lot more Tick events.


It is possible to disable it?

 
snelle_moda:


It is possible to disable it?

I don't think so, as far as I know it's enable on broker side. Maybe you can ask to the broker.
 

I have minimized the number of incoming ticks by only allowing the ticks when the price itself has been changed.


// De sum van de BID/LAST 
   static double dPriceSum;   
   double dOldPriceSum = dPriceSum;
   
// To be used for getting recent/latest price quotes
   MqlTick Latest_Price;      
   SymbolInfoTick(Symbol() ,Latest_Price);

   dPriceSum = Latest_Price.bid + Latest_Price.last; 

// Check if the price is (not)changed.
   if(dPriceSum == dOldPriceSum)
         {
         return;
         }
 
snelle_moda:

I have minimized the number of incoming ticks by only allowing the ticks when the price itself has been changed.


and what if ask price is changing or bid increase 1 point and last decrease 1 point ? A "normal" tick is a change in Bid and/or Ask.
 
angevoyageur:
and what if ask price is changing or bid increase 1 point and last decrease 1 point ? A "normal" tick is a change in Bid and/or Ask.

That's a good point. Maybe I should only use the change in the BID price.

A BAR on the chart is also based on the BID price? 


For the trigger signal of my EA I'm only interested in the change of the price on which the 1 minute BAR is based.

 
Omg. So sleep doesn't help?

What can we do to avoid this?