Demo EA opening multiple trades when it should have only opened one

 

Hi

I've got an EA set up on a Demo Account and then set to run using the VPS services (here) and in Parallel I also have the same EA set up on a live account via a  VPS

This morning something potentially dangerous happened, my Demo EA just kept opening the same trade until the balance was empty and in this particular case the trade lost and the balance was cleaned out, luckily the same thing didn't happen with my live account, I'm surprised since the EA has some logic to only allow one open trade at a time

Has anyone had any experience with this? is it a flaw in the VPS service or perhaps running EAs against demo accounts, perhaps it's a trick brokers use to clean you're account out, I feel it this was live account the broker would have the stance "tough luck" whereas if the trades went in my favour they would cancel the winning trades

 

Bad coding job.

Discard the EA.

 
Marco vd Heijden:

Bad coding job.

Discard the EA.

That's what I'm thinking I'll do

Although the same EA was running in parallel and didn't open continual trades, this to me suggests the problem may not specifically be the code

It's quite concerning as I have the same logic (copy/paste) in a few more EAs that shouldn't open a trade if one is already open, on the plus side I've had these EAs running for months (opening nearly 100 trade) and this is the first time this has happened

But I'll definitely be having a closer look at the code (when I'm home later today) I'll post it up later

 

Well without the code we can speculate forever if there isn't any code to analyze we can talk talk and talk until the end of time but there will not be any solution just empty words who knows why it happened.

It could be anything really. 

My first idea would be that it won't have a PositionTotal filter that limits the maximum position but like i said no code.

 
iRick:

That's what I'm thinking I'll do

Although the same EA was running in parallel and didn't open continual trades, this to me suggests the problem may not specifically be the code

It's quite concerning as I have the same logic (copy/paste) in a few more EAs that shouldn't open a trade if one is already open, on the plus side I've had these EAs running for months (opening nearly 100 trade) and this is the first time this has happened

But I'll definitely be having a closer look at the code (when I'm home later today) I'll post it up later

In ALL cases the problem comes from the code. Most probably something unexpected happened and the EA can't take it into account.
 

You guys were right, coding issue, luckily isolated to the particular EA and even more luck, isolated to the EA running on against the Demo account

Started with an oversight, I had added some OrderSelect logic in various EA without checking the MagicNumber so was finding that different EA trades were being affected, I then added in the MagicNumber check to all the EAs I had running against Demo.... but in this particular one I missed a bit in the OrderCount/PositionTotal count

Definitely need to be more carefully in the future

Reason: