OrderTotal() returns all pending orders.
How can I make it specific to return only for a particular symbol and only for BUY_STOPS.
I’ve been searching for hours in the forum. Only solution I found was written in MQL4.
Is this even possible? Please kindly assist.
- How To Use For loop
- How to get historical trades
- How to get the total number of opened orders and select them in MQL4?
You will have to make your own function that will iterate through all of the orders and count the ones based on the specific conditions, such as symbol and order type.
Here are plenty of examples all are working (searching is our AI): https://www.mql5.com/en/search#!keyword=orderstotal&module=mql5_module_codebase
Chioma Obunadike #: Can I get a sample code please? Would really help. Thank you
There are examples in the documentation. Have a look at the example code for Documentation on MQL5: Trade Functions / OrderGetTicket
Special thanks to everyone who contributed. I have been able to come up with the code. You can check it out here https://www.mql5.com/en/code/43737 for anyone who has the same question in the future.
![Pending Order count-BUY STOPS Pending Order count-BUY STOPS](https://c.mql5.com/36/62/pending-order-count-buy-stops.jpg)
Pending Order count-BUY STOPS
- www.mql5.com
This script counts the number of pending buy stop orders for each symbol and returns the value.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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