Use PositionsTotal() either to check or to start a loop through all open positions.

Documentation on MQL5: Trade Functions / PositionsTotal
- www.mql5.com
PositionsTotal - Trade Functions - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
Ashok Sesha: I have a problem with my EA, My EA is not opneing a new position when already existing position is not closed. I want to open multiple position for a pair even if existing position is not closed. To elaborate, Example below Example EA opens a position of BUY EUR/USD at 1.0000 and TP at 1.0025 but market went to 0.9800, as one position is not closed, EA is not opening any new position. So i am losing opportunity to earn pips in between trades, if EA is able to open again BUY/SELL even if above position is not closed then i can average my profits and exit completely. Hope community would be able to understand and answer my query.
There is obviously a bug in your code which needs to be fixed, or its logic is incorrect. However, without showing your code we can only speculate!

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I have a problem with my EA,
My EA is not opneing a new position when already existing position is not closed. I want to open multiple position for a pair even if existing position is not closed.
To elaborate, Example below
Example
EA opens a position of BUY EUR/USD at 1.0000 and TP at 1.0025 but market went to 0.9800, as one position is not closed, EA is not opening any new position.
So i am losing opportunity to earn pips in between trades, if EA is able to open again BUY/SELL even if above position is not closed then i can average my profits and exit completely.\
Hope community would be able to understand and answer my query.
Thanks