Problem with MT4 Opening a Deal, then Closing it again straight away

 

Hi,

I have a problem with MT4 Opening a Deal, then Closing it again straight away.

It happening with MT4, Built 226, with 4 different EAs and two different brokers.

It only happens occassionally, but has cost me about $4,000 in losses from the spreads

Basically, MT4

* Opens a deal

* Closes is again straight away

* Repeats the steps above dozens of times in sucession.

* When I look at MT4 History in the morning there are dozens of deals, all showing small losses which are about the amount of the spread.

Any suggestions would be appreciated.

See attached example.

Any suggestions appreciated.

 

check open condition and close condition

 
DxdCn:

check open condition and close condition


Hi,

the three EAs were commercial EAs including NightFox and FAP Turbo Long Term. These have been running fine for many months. Both of these EAs are quite mature and stable.

Strange thing is two different accounts with two different brokers (forex.com and GoMarkets) were affected on different days.

Scratching my head trying to figure this one out.

 

Sounds to me like you have a magic number conflict. One EA thinks it should be trading and the other thinks it is outside of trading time, closes the trade. Possibly also this running on a ghost instance of your VPS.

 
kennyhubbard:

Sounds to me like you have a magic number conflict. One EA thinks it should be trading and the other thinks it is outside of trading time, closes the trade. Possibly also this running on a ghost instance of your VPS.


Thanks for the suggestion.

I run about 20 EAs across 4 instances on MT4 on a server in the office.

I keep all of my trades in a database, which includes lookups for the Magic Number. Thus I am confident all of the Magic Numbers are unique.

Both FAP Turbo and NightFox have been running for about 9 months with no problems before.

MT4 call OpenOrder to open the deals, then straight away CloseOrder to close them. The instructions are coming from MT4, not the broker.

I suspect maybe the indicators are getting screwed up, generating signals to trade and then to close.

Initially i thought one EA was monitoring the equity level, and then closing all deals to protest the account if it became too low, but this is not the case.

Any ideas appreciated.

 

for commercial EAs, they are special software tools, their suppliers should define the errors character (evidences like both your and broker's history record, EA's test mode record as replay with history data, et.al, used to recognise who should in charged with it) and supply warranty.

If not define clear in your contract, then you only can pay youself.

such things may be caused several reasons: (1) software bugs, EA's or MT's; (2) temporarily data errors caused EA's bad behavior;

just a guess, no attached any history records .

 

Hi Peter,

Sounds like you have a sophisticated system there and you know what you are doing. Not wanting to flog a dead horse, but there are ways that the magic numbers can become screwed up so I would suggest a double check. I have had the same experience before and it was a magic number conflict. Like you said, it is coming from your own EA's, not the broker and this magic number conflict is just about the only thing I can think of that fits the bill.

 
This highlight's some of the issues with commercial EA's. When you have a problem like this there's no where to turn to. I recommend the maker solve the problem or give you the source code so you can debug it. If that's a no go then use only brokers who are compatible.
 

I'm starting to think MT4 may have problems when handling several EAs at the same time.

For the time being I've shut down all instances of MT4 while I investigate.

When this happened the first time I decompiled the commercial EA, but there was nothing in the logic to cause this problem.

 

P

> The instructions are coming from MT4...

So do you know which instance did the closing, and which EA?

The Experts or Journal tab should reveal this?

-BB-

 

Yes, the same EA in the same instance of MT4 opened and closed the deals.

Each EA for each account only runs in one instance of MT4.

Reason: