EA's opening double orders

 

I have a very strange problem and I'd really apreciate any help!

I'm running several MT4 platforms on a WIndows 2003 server.

Each platform has its own demo account with a different Expert Advisor.

Each time an Expert needs to open a trade, it opens 2 identical trades. Please see attached screen.

It happens with several completely different EA's, so it's not a problem with the Expert logic.

And they all use unique magic numbers!

How is it possible?

Any help or comment most appreciated!

 
It's possible if you put your EA to two charts simultaneously.
 

Put a check on one order per Bar. It seems its opening orders for every tick in your Buy Zone/ Sell Zone.

int currBar; //global

if(currBar!=Bars){

Sell/Buy;

currBar=Bars;

}

 
JForex wrote >>

Put a check on one order per Bar. It seems its opening orders for every tick in your Buy Zone/ Sell Zone.

int currBar; //global

if(currBar!=Bars){

Sell/Buy;

currBar=Bars;

}

Thank you for the responses.

I've tracked the source of the problem, and it's not in the MQ4 logic:

Seems that the server had two instances of the same MetaTraders opened simultaneously, one is under my own server user and the other is a Console session that I discovered was opened.

Each incoming tick, the two MetaTraders (obviously running the same EA) opened the trade simultaeously, without having the chance to see that an order was already opened under that symbol and MagicNumber (because that was only discovered on the next tick, which is too late).

Reason: