portfolio EA , placing to many orders

 
Hello my name is Bruce , I'm trying to build a portfolio EA that trades one order at a time, open to close, in SQX 141. I used Market pos. count = 0 and ended up with two open trades , hoping someone has the answer, I'm using MT5 hedging. Thank You