It seems MT5 is too slow to be reliable

 

MT5 seems to be a lot slower than MT4.
I have labels that give me information in real time, for example PositionsTotal(), and it takes about two or three seconds to update after an order is placed.

At first I thought it was just a slow GUI problem, but it's much worse and more concerning.

I have code that goes like this:

if (PositionsTotal() > 0)   {
    monitorTrade();
}
if (PositionsTotal() == 0)  {
   if (something)       {orderOpen("buy");}
   if (something else)  {orderOpen("sell");}
}

When the right situation triggers the order, the EA is posting two or three orders at a time.
Depending on the price oscillation, it may even place contradicting (buy and sell) orders simultaneously, which is even worse.

That never happened in MT4.

What should I do?

 
whoowl:

MT5 seems to be a lot slower than MT4.
I have labels that give me information in real time, for example PositionsTotal(), and it takes about two or three seconds to update after an order is placed.

Your code has no connection to any labels!

 
Keith Watford #:

Your code has no connection to any labels!

The label is somewhere else in the code.

   name = "LabelDebug9";
   text = "Orders: " + IntegerToString(PositionsTotal());
   if (ObjectFind(0,name) != -1) {ObjectDelete(0,name);}
   ObjectCreate(0, name, OBJ_LABEL, 0, 0, 0);
   ObjectSetString(0,name,OBJPROP_TEXT,text);
        ObjectSetString(0,name,OBJPROP_FONT,"Times New Roman");
        ObjectSetInteger(0,name,OBJPROP_FONTSIZE,fontsize);
        ObjectSetInteger(0,name,OBJPROP_COLOR,Black);
   ObjectSetInteger(0,name,OBJPROP_CORNER,corner);
   ObjectSetInteger(0,name,OBJPROP_XDISTANCE,dx);
   ObjectSetInteger(0,name,OBJPROP_YDISTANCE,dy);


I don't think that matters. The problem is the EA should not be posting or keeping more than one order at a time.

 
whoowl #:

The label is somewhere else in the code.


I don't think that matters. 

If you don't think that it matters, why even mention the label?

Incidentally, why do you keep deleting and re-drawing the label?

You should create it once and then just edit the text.

MT5 reaction to objects can be extremely slow (compared to MT4) and so you should always use ChartRedraw(). 

whoowl #:

The problem is the EA should not be posting or keeping more than one order at a time.

When placing an order do you check whether the order was opened or not?

A new tick could come in while the order is being processed and a new order placed.

 
Keith Watford #:

If you don't think that it matters, why even mention the label?


I mentioned the label because the new information takes too long to be updated so I suspect MT5 is so slow in sending the order and confirming it's been placed that it creates too large a window for additional orders to be posted while the first one is not confirmed yet.


Keith Watford #:

When placing an order do you check whether the order was opened or not?

A new tick could come in while the order is being processed and a new order placed.


Yes, I check it, and the fact that multiple orders are being posted confirms that all of them are being posted


Keith Watford #:

A new tick could come in while the order is being processed and a new order placed.


I suspected that much as stated above. How do I prevent that from happening? I never had that problem with MT4.

 
whoowl #:


I suspected that much as stated above. How do I prevent that from happening? I never had that problem with MT4.

Maybe somebody who is expert at using OnTradeTransaction() can give you some pointers.

Reason: