EA creating two trades instead of one
-
Hello,
I have a strange bug in my EA that is somehow creating two positions despite having flags and checks in place so that only one trade should happen.
My EA checks for certain conditions and flags in order to enter a trade. If all conditions are met, it places a trade, resets the flags and moves on. For some reason, it is now creating two positions when the order is sent and I have no idea why. At the top of my logic, I check for position count, it needs to be less than 1 for this group (yes, double checked all the groups are correct) and if there are no positions it goes down and if all logic is passed, it opens a trade (single buy/sell now) and then resets the flags. No idea why, but this is somehow opening 2 trades.
This EA has previously been working and this is suddenly happening... Any chance there has been some alterations to the back end code?
The condition before the two sells is for testing, it's a boolean check to see if I want to use lots or % for the trade. There is NO way that is being executed at the same time.


-
I ended up finding the issue - something I've never seen before. I have 4 once per bar blocks that execute and they were out of order and this is somehow causing my trades 'once per bar' to execute twice? I re-ordered them and this solved the issue. Still a VERY strange issue considering I disable the flags after a trade is place, at the top of my 'once per bar' I have a number of positions check to make sure it's less than 1, and 'on trade' I disable the flags also.

Sorry - thought I fixed the issue with the above renumbering, but it was actually this block... I didn't realize it goes down the logic path two times in this scenario.
I turned off the 2nd condition and I no longer get double trades. Dummy. -
The most important is you noticing. Congrats!