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

 
7bit:

It is still not known which EA is causing this.


All that we have seen so far are the symptoms and a few theories. We need the experts logs in the folder experts/logs from all 4 terminals covering the same time span to make any further conclusions. These logs could support or dismiss my theory and they will show who is sending the close orders.

i thought he was running each EA on a different account/terminal?

//after i reread the thread i saw that he is running 30 EA's on 4 terminal..

//z.

 
zzuegg:

i thought he was running each EA on a different account/terminal?

we need as many logs as there are terminals. IIRC he mentioned 4 terminals, each running a few EAs. But it doesn't really matter how many, most important is to look at the logs of all terminals at the same time.

A trade opened by EA1 on terminal1 could be closed by EA2 running on terminal2. EA1 would immediately reopen the trade and EA2 would immediately close this trade again ad infinitum.

The experts log of terminal1 would fill up with entries about OPEN and the experts log on terminal2 would fill up with entries about CLOSE. In the account history all losses will be attributed to EA1 because it is the one who opens the trade and EA2 will stay completely under the radar, its name won't be mentioned in the account history. Only in the experts log of the terminal it is running on.


I promise: If the offending EA will have been finally found it will be the only one which did not suffer from all this, the only one that seemed to behave well all the time, the one that is least suspected will be the guilty one.

 

once, one of my EA had similar issius, the guilty code was:

if(Close[1]<Open[1] && Close[2] < Open[2]){
  //CLOSE ALL PROFITALBE BUYS
}

this happend only once... i was fortunate that i closed only the profitable trades... so my EA made 100trades and closed them as soon as they where positive.

 



This problem first occurred in May 2010 and affected an EA called "Callibre"

Woke up in the morning and there was a $4,000 hole in the account, and the History tab took ages to load.

I spoke to the broker, and got a dump of their MT4 server logs (attached).

Also attached is a chart showing the trades.

The server logs correlate that the opening and closing trades came from the same EA.

At the time I blamed the EA, figuring the problem only happened with that EA.

*** From the Comments field in the server transaction log I can tell that the same EA (Callibre in this example) Opened the trades, then closed them straight away.

The problem disappeared for 4 months and I just assumed it was that EA.

The last couple of weeks the problem has reappeared, across 4 different EAs that have been running fine for several months, and across 2 different brokers.

This weekend I'll Uninstall all copies of MT4 and reinstall them from scratch. I'll also clean up the Experts folder and make sure I'm running the latest copy of everything.

Any other suggestions appreciated.
 
 
peterc005:
From the Comments field in the server transaction log I can tell that the same EA (Callibre in this example) Opened the trades, then closed them straight away.

Peter: As I have already explained the comments field shows who opened the trade, it does not show who closed it. This might be misleading and counterintuitive and is the reason you are searching in the wrong place. The comment field is set with the 8th parameter in the OrderSend() function. That is when the order is opened. After this moment the comment field is fixed and can not be changed anymore. OrderClose() does not allow to specify any textual information. No matter how or by whom the order is closed, it will either keep its comment or will be prepended by [sl] or [tp] or a few other strings to indicate stoploss or takeprofit or partial close or margin call, etc.

An order that is closed by OrderClose() will keep its original comment. The only place to ever find out who called OrderClose() is by searching for it in the experts logs of all the terminals that were running at this time.

please attach the 4 expert logs of all 4 terminals that can be found in the folder experts/logs/ on each machine you have a terminal running (this is the log of the "experts" tab of each of these terminals) to find out who closed the trades. It is not the caliber EA.

 

hi 7bit, I'll upload the logs shortly.

One thing I noticed in the logs for the offending days was a lot of these errors:

00:11:16 Memory handler: cannot allocate 160308896 bytes of memory

00:11:16 HistoryBase: not enough memory for 'EURGBP1' in AddTick()

Doing a Google search show this is caused by too many bars in a chart. I had the Max Bars parameter set high so I can download more history, but I have since reduced this setting.

I'm wondering if these errors screwed up the indicator signals, causing problems for the EAs?

Right now this is my favourite theory !!!

 
peterc005:

00:11:16 Memory handler: cannot allocate 160308896 bytes of memory

00:11:16 HistoryBase: not enough memory for 'EURGBP1' in AddTick()


I don't believe this is relevant. And it also does not tell who actually did the call to OrderClose().
 
7bit:
I don't believe this is relevant. And it also does not tell who actually did the call to OrderClose().

I still suspect that a lack of memory resources screwed up an indicator, causing the trades to be opened and closed. If it is the case, it will be very hard to prove it.
 

Below are extracts from the two Logs folders that are an example of what is happening.

This EA is FAP Turbo LT. which I've been running for ages and has always been well behaved.

The Logs folder shows what MT4 does, which is Open and then Close the trade, in this case deal # 2662451

The strange thing is that in the Experts log file, the deal is opened, then modified to set the SL + TP, but there is no record to show it closed.

I looked at other records in the Experts log when FAP Turbo is working OK, and this EA definately generates a Close record usually, but not in this case.

I have looked at all of the log files I could find for other instances of MT4, but there are no other references to this deal.

MT4\Logs folder:

17:28:49 '103028': order was opened : #2662451 buy 0.20 EURUSDFXF at 1.2909 sl: 0.0000 tp: 0.0000

17:28:49 '103028': modify order #2662451 buy 0.20 EURUSDFXF at 1.2909 sl: 0.0000 tp: 0.0000 -> sl: 1.2407 tp: 1.2929

17:29:02 '103028': close order #2662451 buy 0.20 EURUSDFXF at 1.2909 sl: 1.2407 tp: 1.2929 at price 1.2906

17:29:02 '103028': request was accepted by server


MT4\Experts\Logs folder:

17:28:48 FapTurbo50 EURUSDFXF,M5: open #2662451 buy 0.20 EURUSDFXF at 1.2909 ok

17:28:49 FapTurbo50 EURUSDFXF,M5: modify #2662451 buy 0.20 EURUSDFXF at 1.2909 sl: 1.2407 tp: 1.2929 ok

Reason: