Alert: MT4 Terminal Duplicating Orders Sent by Experts

 

Something awkward is happening with the MT4 trading accounts everywhere (it can happen with any broker, as far as I can tell). The platform is sometimes, though rarely, duplicating orders sent by experts.

 I have seen this happen at least 3 times with build MT4 build 500. The first two were on demo accounts, and the last one, yesterday, was on a real account. The problem has happened:

1)      On different MT4 installations.

2)      On different computers.

3)      With different brokers.

4)      Using different expert advisors.

 

Besides all of the above, the fact that tells me that this is a problem with the terminal is very easy to verify. When the duplicate order happens:

1)      It happens immediately after the legitimate order, with exactly the same lot size, symbol, and comment.

2)      The first operation, as usual, is shown on the experts tab, as well as on the journal tab. However, the duplicate is shown on the journal, but it is NOT shown on the experts tab. This is a reliable proof that the duplicate was NOT sent by the expert.

 

I urge Metaquotes to fix this problem as soon as possible. Yesterday I had to close the duplicate operation manually, and I lost money, though not too much. But this problem can really wreak havoc on an automated account.

Please if any of you have seen this problem, report it so that we have additional evidence and the corresponding bug is fixed quickly.

 
Ricardo1:

I think the question here is that your EAs are designed to work on a tick per tick basis, so for instance if the EA is on average crossing on M5, during that 5 minutes the price flows and could make your conditions to send orders happen more than once.


Solution would be setting a filter on sending orders to check wether you are open or have orders on the market or not. Or working on a Bar basis. I'm sorry but i'm a newbee and i can think on which is the problem but cannot post you any code :).

Hope this helps.

 
Ricardo1: I urge Metaquotes to fix this problem as soon as possible.
Why do you think the problem is with MT4 and not with your EA? Post your code.
 
Ricardo1:

Something awkward is happening with the MT4 trading accounts everywhere (it can happen with any broker, as far as I can tell). The platform is sometimes, though rarely, duplicating orders sent by experts.

 I have seen this happen at least 3 times with build MT4 build 500. The first two were on demo accounts, and the last one, yesterday, was on a real account. The problem has happened:

1)      On different MT4 installations.

2)      On different computers.

3)      With different brokers.

4)      Using different expert advisors.

You need to quit the other copy of your EA that is running on the other chart . . .  if this isn't the case please prove it by posting the experts log file showing the expert starting and the duplicate orders.  This mistake has been made before . . .

 

You guys amaze me somewhat. You assume that I must be doing something wrong, that MT4 cannot possibly have bugs. Here I will address your answers.


xavilin:


This is not a problem of the EA. The EA I'm using has more than a year working on different platforms. Besides, this problem has happened with 3 different EA's, two of mine and a commercial one.


WHRoeder:

I cannot post my code, but as I said, the problem has happened on 3 different EAs. It never happens on backtesting of course. As I told you, *this happens very rarely*. In fact, if you sum the time that my EA (the one I was using yesterday) has been running, summing all of the accounts it would have been running for a few years. And yesterday it happened for the *first* time. Do you think that can be a bug in my code?


RaptorUK:

Do you really think I am so naive to have more than one EA in the account and then report this as a problem?


As I said before, the main proof is that the journal tab has the order, but the experts tab *doesn't*. It is literally impossible that an EA is sending the order and yet the experts tab doesn't report it!

I could post both the experts log and the journal log here, but for privacy reasons it is not possible for me. But I don't think it is necessary. If you believe that I can read both files and tell you what they say, then believe that the bogus order is contained on the journal log and it is not contained on the experts log, so it was not initiated by any expert at all. And of course it was not initiated by me.

It is true that I would like your support, but it is for the benefit of all of us users. If you think there is no error at all, Metaquotes will take more time to acknowledge the bug.

I felt obliged to share this with you, and I hope Metaquotes at least does some checking.

 
Ricardo1: You guys amaze me somewhat. You assume that I must be doing something wrong, that MT4 cannot possibly have bugs. Here I will address your answers.

I don't know how to say this nicely without ticking someone like you off. But you need to change your attitude. When someone claims something is a bug, that means it's re-producible. You have no manner of re-producing the bug, claims it happens "*first* time" whatever that means, and provide no code to exclude that the code isn't the problem. How is anyone suppose to track this down?

Not to mention of the millions of people using this software to place lord-know how many millions of trades daily; you're the only person this is happening to. Trust me when it comes to money, if this was happening to everyone (rarely) we all on this forum would still be hearing about it often. Allot of people come here crying bug and 99% of the time the problem lies within their codes. Once I stop placing blames, I managed to solve allot of my coding problems faster.

Ps: RaptorUK does not represent MetaQuotes, he's a social moderator and his comments holds about as much weight as yours/mines. Why couldn't this be a problem with the Broker? Until others start reporting this bug-of-yours, IMO the burden of proof is on you.

 
Ricardo1:


RaptorUK:

Do you really think I am so naive to have more than one EA in the account and then report this as a problem?


As I said before, the main proof is that the journal tab has the order, but the experts tab *doesn't*. It is literally impossible that an EA is sending the order and yet the experts tab doesn't report it!

I could post both the experts log and the journal log here, but for privacy reasons it is not possible for me. But I don't think it is necessary. If you believe that I can read both files and tell you what they say, then believe that the bogus order is contained on the journal log and it is not contained on the experts log, so it was not initiated by any expert at all. And of course it was not initiated by me.

It is true that I would like your support, but it is for the benefit of all of us users. If you think there is no error at all, Metaquotes will take more time to acknowledge the bug.

I felt obliged to share this with you, and I hope Metaquotes at least does some checking.


As I said . . .  it has been done before  (I looked for the post and my replies but couldn't find them) and the OP also assumed a MT4 issue . . .

If you post no evidence to investigate and you post no method to reproduce the issue how do you expect anyone to investigate and help ?  by all means raise a Service Desk issue but you don't seem to want to offer any useful information to help identify/diagnose the issue.  What privacy issues are you concerned about ?  you can edit/remove  (search&replace) your account numbers . . .  you don't need to post the whole log,  just enough from when the EA starts till the duplicate order shows up . . . 

Look in your Order History is the Order there ?  write a  small script to interrogate the Order in the History pool to see if it has a Magic Number,  does your EA use a Magic Number ?  there are things you can do to investigate . . .  you will want to know if this problem is cause by you or the EAs you have been running,  you and everyone else would like to know if it's caused by MT4.  It is in your hands,  you have the information, we don't . . .

 

ubzen and RaptorUK: Thank you very much for your answers.

ubzen, you have a point there when you say: "Not to mention of the millions of people using this software to place lord-know how many millions of trades daily; you're the only person this is happening to." I cannot answer that objection. I run quite a few EA's on several accounts and I have seen this happen 3 times with build 500, on 2 different broker platforms. However, as I've seen the evidence itself, I do not doubt it, even if hundreds or thousands of others have not spoken yet.

Nevertheless, when you say "When someone claims something is a bug, that means it's re-producible", I have to say you're wrong. The most difficult bugs are precisely those that are not reproducible by the user. They happen rarely, and as software giants know, they can take a lot of time and effort to track down. They happen rarely because they require a definite set of conditions that are not always under the user's control. Anyone using something like Microsoft Office extensively can attest to that.

RaptorUK, thank you for the offer to post the files omitting personal data. I will post them right in this window, omitting my personal details. (ubzen: I don’t think that the burden of proof is on me, as I have no need to prove anything, but I want to show you, just in case it interests anyone).


Experts log for 2013.06.11:

22:32:05 Expert Advisor 1 EURCHF,M15: Requested Open Price for BUY Order: 1.2307

22:32:07 Expert Advisor 1 EURCHF,M15: open #20212520 buy 0.01 EURCHF at 1.2307 sl: 1.2232 tp: 1.2320 ok

 

Journal log for 2013.06.11:

05:14:12 ‘000000’: login

05:14:30 ‘000000’: login

05:14:31 ‘000000’: previous successful authorization performed from 201.141.75.152

08:10:12 ‘000000’: login

08:10:17 ‘000000’: login

08:10:19 ‘000000’: previous successful authorization performed from 201.141.75.152

20:33:35 ‘000000’: login

20:33:43 ‘000000’: DataCenter connecting failed [2]

20:33:44 ‘000000’: previous successful authorization performed from 201.141.75.152

22:32:06 ‘000000’: instant order buy 0.01 EURCHF at 1.2307 sl: 1.2232 tp: 1.2320

22:32:07 ‘000000’: request was accepted by server

22:32:07 ‘000000’: request in process

22:32:07 ‘000000’: order was opened : #20212520 buy 0.01 EURCHF at 1.2307 sl: 1.2232 tp: 1.2320

22:32:08 ‘000000’: instant order buy 0.01 EURCHF at 1.2307 sl: 1.2232 tp: 1.2320

22:32:08 ‘000000’: request was accepted by server

22:32:08 ‘000000’: request in process

22:32:10 ‘000000’: order was opened : #20212521 buy 0.01 EURCHF at 1.2307 sl: 1.2232 tp: 1.2320

23:07:26 ‘000000’: one click trading has been enabled

23:07:31 ‘000000’: close order #20212521 buy 0.01 EURCHF at 1.2307 sl: 1.2232 tp: 1.2320 at price 1.2291

23:07:32 ‘000000’: request was accepted by server

23:07:32 ‘000000’: request in process

23:07:32 ‘000000’: order #20212521 buy 0.01 EURCHF at 1.2307 sl: 1.2232 tp: 1.2320 closed at price 1.2291


As you can see, order 20212520 was initiated by the expert. However, order 20212521 was NOT. This bogus order was closed manually (the last 5 lines of the journal file correspond to manual operations).

I am being redundant here, but I shall say it again: Since the bogus order 20212521 is not reported in the experts log, it was not initiated by any expert, so the code of the expert is irrelevant for this purpose.

 

Ricardo1:

...

As you can see, order 20212520 was initiated by the expert. However, order 20212521 was NOT. This bogus order was closed manually (the last 5 lines of the journal file correspond to manual operations).

I am being redundant here, but I shall say it again: Since the bogus order 20212521 is not reported in the experts log, it was not initiated by any expert, so the code of the expert is irrelevant for this purpose.

Are your EA use a magic number ?

If yes, then can you check if your "bogus" order have a magic number. You can see that in the history tab : scroll the windows to see the order, then place your mouse on this order (without clicking), a tooltip must be displayed with something like :

#20212521, id 12345

If there is no magic number then id field is missing.

 
Ricardo1:


22:32:06 ‘000000’: instant order buy 0.01 EURCHF at 1.2307 sl: 1.2232 tp: 1.2320

22:32:07 ‘000000’: request was accepted by server
22:32:07 ‘000000’: request in process
22:32:07 ‘000000’: order was opened : #20212520 buy 0.01 EURCHF at 1.2307 sl: 1.2232 tp: 1.2320

22:32:08 ‘000000’: instant order buy 0.01 EURCHF at 1.2307 sl: 1.2232 tp: 1.2320
22:32:08 ‘000000’: request was accepted by server
22:32:08 ‘000000’: request in process
22:32:10 ‘000000’: order was opened : #20212521 buy 0.01 EURCHF at 1.2307 sl: 1.2232 tp: 1.2320


As you can see, order 20212520 was initiated by the expert. However, order 20212521 was NOT.

What I see was the EA opened an order and a second later it opened another. Not that two packet went out together.

Put a print statement before and after the OrderSend and prove that you are calling it twice.

 
angevoyageur:

Are your EA use a magic number ?

If yes, then can you check if your "bogus" order have a magic number. You can see that in the history tab : scroll the windows to see the order, then place your mouse on this order (without clicking), a tooltip must be displayed with something like :

#20212521, id 12345

If there is no magic number then id field is missing.



Everything in the bogus order is the same as in the original order, including comment and magic number. However, the EA did not send it; as I said, the experts log proves it.
Reason: