OrderTotal()

 
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. 
 
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.
 

1) Loop trough your orders (OrderTotal())

2 Check if OrderType() == BUY_STOP

3) Check if OrderSymbol() == Symbol()

 
Amira J Brand #:

1) Loop trough your orders (OrderTotal())

2 Check if OrderType() == BUY_STOP

3) Check if OrderSymbol() == Symbol()

Can I get a sample code please? Would really help. Thank you

 
Chioma Obunadike #:

Can I get a sample code please? Would really help. Thank you

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
  • www.mql5.com
This script counts the number of pending buy stop orders for each symbol and returns the value.
Reason: