OrdersTotal() is the number of open orders including pending orders
OrdersHistoryTotal() is the number of closed orders and may include cancelled pending orders
if the price hits 90 and the buystop get triggered, but not the stoploss or takeprofit, it is a open position right? is there a function to count this? Do not count if the stoploss/takeprofit is triggered (close position).
A current pending order is still an open order even though it has not yet triggered.
If you want to check how many open pending orders there are, loop through the open orders and check OrderType()
OrdersTotal() is the number of open orders including pending orders
OrdersHistoryTotal() is the number of closed orders and may include cancelled pending orders
A current pending order is still an open order even though it has not yet triggered.
If you want to check how many open pending orders there are, loop through the open orders and check OrderType()
I was misinterpreting the OrdersTotal() as open orders only. Thanks for the clarification :)
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi,
Im a student who have just started trying MQL4. Im having issue finding the function to count the number of open position. Also, confused with the jargon so there may be some error in the words.
Lets say the price is 80 and i put an pending order to buystop at 90. To count the number of pending order, i use OrdersTotal() . correct?
if the price hits 90 and the buystop get triggered, but not the stoploss or takeprofit, it is a open position right? is there a function to count this? Do not count if the stoploss/takeprofit is triggered (close position).
OrdersHistoryTotal() would count both the open and close position right? Is there a way to count only the open position? or a way to count all the closed position so i can work backwards?
Thank you in advance for helping this newbie