Order request sometimes not being dispatched to server, causing trade timeout error. Could be a bug.
It seems that this is a bug. Please fix this.
The modification failed for an open order, not a pending one. That happened at the broker's server. The server did not send back a response.
The server could have crashed, was overworked and lost the request, or the result was lost coming back to your machine. In any case, the problem was outside mt4.
On a trade timeout you have no idea wither the command happened or not.
The modification failed for an open order, not a pending one. That happened at the broker's server. The server did not send back a response.
The server could have crashed, was overworked and lost the request, or the result was lost coming back to your machine. In any case, the problem was outside mt4.
On a trade timeout you have no idea wither the command happened or not.
You have not looked at the extracts of the logs carefully. OrderModify failed in both open order and pending order cases.
Your explanations are poor, e.g. "server could have crashed". Then you say "In any case, the problem was outside mt4", which is laughable because most of your explanations in the same line are MetaTrader server related problems and therefore are not "outside mt4".
In the Journal log, there should at least be the initial line that shows the details of the request (before sending the request to the server), then the line "request was accepted by server". Why weren't there such lines in each execution failure? At least the initial detail line (e.g. "modify pending order #29667370 sell limit 0.01 EURUSD at 1.34202 sl: 1.34902 tp: 1.33252 -> price: 1.34202 sl: 1.34962 tp: 1.33392") should appear, as, I believe, this particular line has nothing to do with the network or communication with the server.
However, it often seems that the request is never dispatched, and the order function is kept waiting for a response from the server until the trade timeout error finally occurs. I have seen it happen on all brokers.
I don't think that's bug. The request was sent, though I don't know why MetaTrader didn't report it on it's journal. It returned timeout because MetaTrader doesn't get any response from server on time. I don't know why either.
Use some network traffic monitor software to see out going traffic and it's IP destination.
If you don't mind, please tell us the MetaTrader build numbers.
It's not bad to add ...
int start = GetTickCount () //--some order sending codes start = GetTickCount () - start; Print ("Order sends took "+start+" miliseconds to complete");
... to see how long does it takes.
Don't use IsConnected (), because it tells about 5 - 10 seconds later that you don't have connection. Use this instead :
#import "Connect.dll" int IsInternetConnected(); // 0 = connected 1 = not connected while (true) { if (IsInternetConnected() == 1) { Print ("WinAPI not connected"); } else { Print ("WinAPI connected"); } if (IsConnected () == false) { Print ("MetaTrader not connected"); } else { Print ("MetaTrader connected"); } }
Now, run it, disconnect yourself from the net (or connect again), and look at the print time and compare the two, but at least you must running Vista http://msdn.microsoft.com/en-us/library/windows/desktop/aa366143(v=vs.85).aspx
BTW, seriously, share to us, how do you write ICMP Ping in MQL4 ?, May come handy to others, you know.
Have a nice day with MetaTrader
:)
Your explanations are poor, e.g. "server could have crashed". Then you say "In any case, the problem was outside mt4", which is laughable because most of your explanations in the same line are MetaTrader server related problems and therefore are not "outside mt4".
In the Journal log, there should at least be the initial line that shows the details of the request (before sending the request to the server), then the line "request was accepted by server". Why weren't there such lines in each execution failure? At least the initial detail line (e.g. "modify pending order #29667370 sell limit 0.01 EURUSD at 1.34202 sl: 1.34902 tp: 1.33252 -> price: 1.34202 sl: 1.34962 tp: 1.33392") should appear, as, I believe, this particular line has nothing to do with the network or communication with the server.
- Have you ever gone to a web site and got 'connection error'/'problem loading page'. There was a problem with the server or network to. Do you go and write support requests to M$ or firefox or whoever made your browser? No, the problem was not your browser, it was the site and your browser just reported it.
- There was not 'request was accepted by server' message because MT4 never got an acknowledgment. That's not a bug in MT4. Can't be at mt4 or your machine or the other sends would ALSO be bad. It's a problem OUTSIDE mt4. Could be communications to the server, at the server, back from the server - no way to know from a non-response, other than there was a problem.
- Using IsConnected() or IsInternetConnected() only tells you the current state which might change the millisecond you send a request. Bad communications is bad communications, you can't fix that, code to recover.
- If it happens a lot, switch brokers or get a VPS closer to the broker.
Ah, I didn't carefully read your reply to WHRoeder there, but you are right, that ...
In the Journal log, there should at least be the initial line that shows the details of the request (before sending the request to the server), then the line "request was accepted by server". Why weren't there such lines in each execution failure? At least the initial detail line (e.g. "modify pending order #29667370 sell limit 0.01 EURUSD at 1.34202 sl: 1.34902 tp: 1.33252 -> price: 1.34202 sl: 1.34962 tp: 1.33392") should appear, as, I believe, this particular line has nothing to do with the network or communication with the server.
If you'd still like to give a shot, then let have some fun, write something like this :
int start = GetTickCount ()
Print ("Me gonna send order at "+TimeToStr (TimeLocal (), TIME_SECONDS)+" = "+TimeToStr (TimeCurrent (), TIME_SECONDS));
//--some order sending codes
start = (GetTickCount () - start)/1000;
Print ("Order sends took "+start+" seconds to complete at "+TimeToStr (TimeLocal (), TIME_SECONDS)+" = "+TimeToStr (TimeCurrent (), TIME_SECONDS));
Now, compare the time on expert and journal log. Maybe, that log was written only after successful order execution. Just maybe.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Each order operation request (OrderSend, OrderModify, OrderClose) goes through a number of stages, with the first steps being display of the details in the Journal log and the transmission of the request to the server.
However, it often seems that the request is never dispatched, and the order function is kept waiting for a response from the server until the trade timeout error finally occurs. I have seen it happen on all brokers.
Below are some extracts from Journal log files of some tests that I've ran over the past few days at 7 different brokers. In each set of lines, the first four lines show a successful execution of OrderModify. The last line, which I have shown in red, shows the next execution of OrderModify that resulted in failure with the timeout error.
At broker 1:
01:35:18 '484698': modify pending order #29667370 sell limit 0.01 EURUSD at 1.34202 sl: 1.34902 tp: 1.33252 -> price: 1.34202 sl: 1.34962 tp: 1.33392
01:35:54 '484698': request was accepted by server
01:35:54 '484698': request in process
01:35:54 '484698': pending order #29667370 sell limit 0.01 EURUSD was modified -> price: 1.34202 sl: 1.34962 tp: 1.33392
01:44:45 '484698': modification of pending order #29667370 sell limit 0.01 EURUSD at 1.34202 sl: 1.34962 tp: 1.33392 -> price: 1.34203 sl: 1.35143 tp: 1.33223 failed [Trade timeout]
At broker 2:
00:19:11 '91118023': modify order #81190473 buy 0.01 EURUSD at 1.33640 sl: 1.32719 tp: 1.34409 -> sl: 1.32718 tp: 1.34368
00:19:11 '91118023': request was accepted by server
00:19:11 '91118023': request in process
00:19:11 '91118023': order #81190473 buy 0.01 EURUSD at 1.33640 was modified -> sl: 1.32718 tp: 1.34368
00:30:01 '91118023': modification of order #81190474 buy 0.01 EURUSD at 1.33640 sl: 1.32570 tp: 1.34390 -> sl: 1.32542 tp: 1.34482 failed [Trade timeout]
At broker 3:
00:10:51 '1250889': modify pending order #18975562 buy stop 0.01 EURUSD at 1.34104 sl: 1.33534 tp: 1.34764 -> price: 1.34105 sl: 1.33455 tp: 1.35015
00:10:51 '1250889': request was accepted by server
00:10:51 '1250889': request in process
00:10:51 '1250889': pending order #18975562 buy stop 0.01 EURUSD was modified -> price: 1.34105 sl: 1.33455 tp: 1.35015
00:17:41 '1250889': modification of pending order #18975562 buy stop 0.01 EURUSD at 1.34105 sl: 1.33455 tp: 1.35015 -> price: 1.34105 sl: 1.33475 tp: 1.34935 failed [Trade timeout]
At broker 4:
00:36:52 '91130020': modify pending order #81193954 sell limit 0.01 EURUSDFXF at 1.3431 sl: 1.3495 tp: 1.3336 -> price: 1.3431 sl: 1.3512 tp: 1.3370
00:36:52 '91130020': request was accepted by server
00:36:52 '91130020': request in process
00:36:52 '91130020': pending order #81193954 sell limit 0.01 EURUSDFXF was modified -> price: 1.3431 sl: 1.3512 tp: 1.3370
00:57:42 '91130020': modification of pending order #81193954 sell limit 0.01 EURUSDFXF at 1.3431 sl: 1.3512 tp: 1.3370 -> price: 1.3431 sl: 1.3512 tp: 1.3350 failed [Trade timeout]
At broker 5:
00:02:48 '7113414': modify pending order #106760574 sell limit 0.01 EURUSD at 1.34307 sl: 1.35107 tp: 1.33407 -> price: 1.34310 sl: 1.34830 tp: 1.33770
00:02:48 '7113414': request was accepted by server
00:02:48 '7113414': request in process
00:02:48 '7113414': pending order #106760574 sell limit 0.01 EURUSD was modified -> price: 1.34310 sl: 1.34830 tp: 1.33770
00:10:38 '7113414': modification of pending order #106760574 sell limit 0.01 EURUSD at 1.34310 sl: 1.34830 tp: 1.33770 -> price: 1.34312 sl: 1.35282 tp: 1.33652 failed [Trade timeout]
At broker 6:
01:12:34 '2048270041': modify pending order #1864902 sell limit 0.01 EURUSD at 1.34307 sl: 1.35097 tp: 1.33617 -> price: 1.34309 sl: 1.34819 tp: 1.33629
01:12:34 '2048270041': request was accepted by server
01:12:34 '2048270041': request in process
01:12:34 '2048270041': pending order #1864902 sell limit 0.01 EURUSD was modified -> price: 1.34309 sl: 1.34819 tp: 1.33629
01:33:24 '2048270041': modification of pending order #1864902 sell limit 0.01 EURUSD at 1.34309 sl: 1.34819 tp: 1.33629 -> price: 1.34309 sl: 1.34899 tp: 1.33519 failed [Trade timeout]
At broker 7:
22:15:14 '804826': modify order #14445876 sell 0.01 EURUSD at 1.33349 sl: 1.34357 tp: 1.32967 -> sl: 1.34649 tp: 1.33199
22:15:14 '804826': request was accepted by server
22:15:14 '804826': order #14445876 sell 0.01 EURUSD at 1.33349 was modified -> sl: 1.34649 tp: 1.33199
22:21:04 '804826': modification of order #14442447 sell 0.01 EURUSD at 1.33553 sl: 1.34369 tp: 1.32759 -> sl: 1.34251 tp: 1.32941 failed [Trade timeout]
You can see that in a successful execution, there is firstly a line showing the details of the request, then the line "request was accepted by server", then "request in process" (except broker 7 didn't show this line), then the final result line that contains the text "was modified".
However, for the failed OrderModify executions shown (in red) above, there were none of the first few lines. There is no indication of communication with the server. Only after a few minutes of waiting (within the OrderModify function), during which the trade context is occupied (and therefore no other order requests can be submitted), a single line finally appears with the OrderModify failure result and trade timeout error.
It seems that this is a bug. Please fix this.