MQL5 -> OrderSend delay to execute order (done in 150063.782 ms)

 

QUESTION 1:

I got a problem with OrderSend.

The order was executed in  150063.782 ms It's too much.

Take a look at the log: (I ommited the account and change the deal number on this log for security reasons..)

OP 0 13:46:06.258 Trades '00000': market sell 1.00 EURUSD
KJ 0 13:48:36.330 Trades '00000': deal #98765432 sell 1.00 EURUSD at 1.13115 done (based on order #12345678)
HP 0 13:48:36.330 Trades '00000': order #12345678 sell 1.00 / 1.00 EURUSD at 1.13115 done in
150063.782 ms

The support of the broker told me that the order was received on the server on moment of the request that was on 13:46:06.258 

And executed on that time, but said the message of delay 1500063.782 does not say about the order execution just about the delay of sending the message of execution

But the method return OrderSend, was executed just in: 13:48:36.330 saying 1500063.782 ms of delaydasdf

Is this correct, this message of delay (done in x milliseconds) is just a delay of the message return, or the execution do really delayed the 150063.782 ms?

Is there a documentation where I can found about this issue?

 

QUESTION2: 

The MQL5 locked on OrderSend because of this delay of execution.

Is there a way to not lock the code on OrderSend and continue on? 

 
felipeforexmj:

QUESTION 1:

I got a problem with OrderSend.

The order was executed in  150063.782 ms It's too much.

Take a look at the log: (I ommited the account and change the deal number on this log for security reasons..)

OP 0 13:46:06.258 Trades '00000': market sell 1.00 EURUSD
KJ 0 13:48:36.330 Trades '00000': deal #98765432 sell 1.00 EURUSD at 1.13115 done (based on order #12345678)
HP 0 13:48:36.330 Trades '00000': order #12345678 sell 1.00 / 1.00 EURUSD at 1.13115 done in
150063.782 ms

The support of the broker told me that the order was received on the server on moment of the request that was on 13:46:06.258 

And executed on that time, but said the message of delay 1500063.782 does not say about the order execution just about the delay of sending the message of execution

But the method return OrderSend, was executed just in: 13:48:36.330 saying 1500063.782 ms of delaydasdf

Is this correct, this message of delay (done in x milliseconds) is just a delay of the message return, or the execution do really delayed the 150063.782 ms?

Is there a documentation where I can found about this issue?

 

QUESTION2: 

The MQL5 locked on OrderSend because of this delay of execution.

Is there a way to not lock the code on OrderSend and continue on? 

1. In the case of MT4 yes the OrderSend() function returns if the order was successful (ticket number) or flase (-1)

There can be a delay caused by a lot of factors, say you are currently downloading some large file or someone else on your LAN has a high network load it can be anything.

2.In the case of MT5 you can use

bool  OrderSendAsync(
   MqlTradeRequest&  request,      // Request structure
   MqlTradeResult&   result        // Response structure
   );

In that case you can send an order without waiting for the trade server's response to a sent request.

So it can not lock up.

https://www.mql5.com/en/docs/trading

Documentation on MQL5: Trade Functions
Documentation on MQL5: Trade Functions
  • www.mql5.com
Trade Functions - Reference on algorithmic/automated trading language for MetaTrader 5
 
Marco vd Heijden:

1. In the case of MT4 yes the OrderSend() function returns if the order was successful (ticket number) or flase (-1)

2.In the case of MT5 you can use

In that case you can send an order without waiting for the trade server's response to a sent request.

So it can not lock up.

https://www.mql5.com/en/docs/trading

About the question 1: 

The question was not about whether the return of the OrderSend is successful or not, but the delay of the return.

It took 150 seconds. It's too much.

 
felipeforexmj:

About the question 1: 

The question was not about whether the return of the OrderSend is successful or not, but the delay of the return.

It took 150 seconds. It's too much.

You are not providing enough information.

Does it take 150 seconds ALL (every) time or just once, or maybe some times?

How fast is the other data traffic ? did you run tests to see that? did you check the server connection? what does it say?

What your broker is telling you is impossible.

It is impossible your broker received the order at the exact time you ordered it, there has to be at least some delay caused by network nodes.

Are you suspecting your broker to cause this delay ?

It is in the nature of MT4 that it works like that and that is why i offered the MT5 asynchronous alternative.

It would be impossible at this point to simply guess what is causing your delay.

I agree on the fact that is is UN-acceptable.

Realize that in certain situations, the orders have to be matched against, counter parties and if there is not enough of that available, it can take some time.

If that is the case, it's time to connect to a more active pool, or to switch to dma, if you know what i mean.

 
Marco vd Heijden:

You are not providing enough information.

Does it take 150 seconds ALL (every) time or just once, or maybe some times?

How fast is the other data traffic ? did you run tests to see that? did you check the server connection? what does it say?

What your broker is telling you is impossible.

It is impossible your broker received the order at the exact time you ordered it, there has to be at least some delay caused by network nodes.

Are you suspecting your broker to cause this delay ?

It is in the nature of MT4 that it works like that and that is why i offered the MT5 asynchronous alternative.

It would be impossible at this point to simply guess what is causing your delay.

I agree on the fact that is is UN-acceptable.

Realize that in certain situations, the orders have to be matched against, counter parties and if there is not enough of that available, it can take some time.

If that is the case, it's time to connect to a more active pool, or to switch to dma, if you know what i mean.

No this doesn't happens  frequently. 

It happed just once.

The data traffic is very fast. The latency is about 20 milliseconds.

The broker didn't tell me the time was exactly the same time I ordered it, but said that the time the return of OrderSend execution is not the time the order entered.

A priori, I don't think the broker caused the problem, but this delay took too much 150 seconds, to OrderSend to be responsed (unlocked) it's a bit weird.

Is there a way to get the delay the broker sent the order with OrderSend? 

 

I'm implementing on MQL5 OrderSendAsync, the MqlTradeResult doesn't have any information about the delay of exection. Must I rely on OnTradeTransation?

 

About the DMA I didn't kwew about it. Is it about DMA (Direct Market Access)?

Is this a common feature in any broker?

I saw that there's a DOM access (depth of the market book access). 

Do you recommend a broker which is reliable?

 
felipeforexmj:

No this doesn't happens  frequently. 

The data traffic is very fast. The latency is about 20 milliseconds.

I mean this:

felipeforexmj:


The broker didn't tell me the time was exactly the same time I ordered it, but said that the time the return of OrderSend execution is not the time the order entered.

felipeforexmj:

OP 0 13:46:06.258 Trades '00000': market sell 1.00 EURUSD

The support of the broker told me that the order was received on the server on moment of the request that was on 13:46:06.258 

But you did.

felipeforexmj:

Is there a way to get the delay the broker sent the order with OrderSend?

Not really results can vary sometimes everything goes flawless and then you try a different broker and immediately notice a huge increase in order execution... i always decide to avoid 'those'

felipeforexmj:

I'm implementing on MQL5 OrderSendAsync, the MqlTradeResult doesn't have any information about the delay of exection. Must I rely on OnTradeTransation?

Yes but i don't see any reason, unless you are scalping 10+lots on mere ticks, a few ms won't matter that much if you take on longer positions, which brings me to the point, if your delay is the same whether in sync or async, it won't make any difference in the result other then your code is a bit faster, the trades will still be the same.

It means you are trying to fix the problem from the wrong side....

You can throw whatever you want towards it but if it can not be solved on your side you are completely wasting your time.

If you need a good broker you need to find one... by doing your own research i do not recommend them because i know the research can be very revealing, and interesting it will give you a lot more knowledge then when i tell you just use this or that.

And you should never take someone else's word for granted.

Just make a list and start reading the available info, i assure you there will not be many brokers left when you are at the end of that list.