Abhishek Yadav: Hello Guys, i am little confused in finding the total no. of opened positions. I am only seeing OrderTotal, which is total no of opened and pending positions. It's occurring in Mql4. In Mql5 we simply get opened positions by PositionsTotal(); and pending positions by OrdersTotal(); . If any one have solution please respond. Thank You in advance.
In MQL4,there are only "Orders" which includes Pending Orders and Market Orders, where Market Orders are equivalent to "Positions" in MQL5.
So to count Market Orders ("Positions"), you have to loop over all the "Orders" and count all the Market Orders (which are identified as having a OrderType() of either OP_BUY or OP_SELL).
OrderType - Trade Functions - MQL4 Reference
- docs.mql4.com
OrderType - Trade Functions - MQL4 Reference
Fernando Carreiro #:
In MQL4,there are only "Orders" which includes Pending Orders and Market Orders, where Market Orders are equivalent to "Positions" in MQL5.
So to count Market Orders ("Positions"), you have to loop over all the "Orders" and count all the Market Orders (which have a OrderType() of either OP_BUY or OP_SELL).
Thank You so much Fernando. it was helpful.
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
Hello Guys, i am little confused in finding the total no. of opened positions. I am only seeing OrderTotal, which is total no of opened and pending positions. It's occurring in Mql4. In Mql5 we simply get opened positions by PositionsTotal(); and pending positions by OrdersTotal(); . If any one have solution please respond. Thank You in advance.