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)
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.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
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)
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.