Hi , i am wrestling with me ea to open a new position after it sets the initial one at be - page 2

 
Conor Mcnamara #:

solution:

when one position is opened, PositionsTotal() = 0 (just so you know)

basically made a typo here, I don't mean to confuse...I meant when no positions are opened PositionsTotal is zero, so using this in a condition enables you to make a rule such that the next logic will be processed only if there are no positions already open (or X number of positions already open)

 
Conor Mcnamara #:

basically made a typo here, I don't mean to confuse...I meant when no positions are opened PositionsTotal is zero, so using this in a condition enables you to make a rule such that the next logic will be processed only if there are no positions already open (or X number of positions already open)

As a mere side note, I would add that a timer or Sleep instance may be needed following a sent order... especially if your machine is running MT5 faster than MT5 can communicate with the trade server. Otherwise, multiple orders can be sent as MT5 awaits an update of PositionsTotal.