MODE_TRADES (default)- order selected from trading pool(opened and pending orders)
To my recollection Orderselect can't exclude pending orders.
Use OrderType()
It's either OP_BUY or OP_SELL
See here https://docs.mql4.com/trading/ordertype
And make sure to select the order first by using OrderSelect() function.

- docs.mql4.com
OrderSelect(index or ticket, flag, mode)
MODE_TRADES (default)- order selected from trading pool(opened and pending orders)
To my recollection Orderselect can't exclude pending orders.
you can choose after you selected the order, that is what "select" means
Use OrderType()
It's either OP_BUY or OP_SELL
See here https://docs.mql4.com/trading/ordertype
And make sure to select the order first by using OrderSelect() function.
I think this way still could select pending orders and check it's type what I need is just opened orders not pending ones.
You can simply reject any order other then OP_BUY and OP_SELL in your code.
Then it will just skip any pending orders.
They carry a different identifier.
OP_BUY - buy order, OP_SELL - sell order, OP_BUYLIMIT - buy limit pending order, OP_BUYSTOP - buy stop pending order, OP_SELLLIMIT - sell limit pending order, OP_SELLSTOP - sell stop pending order.
You can simply reject any order other then OP_BUY and OP_SELL in your code.
Then it will just skip any pending orders.
They carry a different identifier.
Thanks, that's new knowledge for me, much obliged.

- 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, fellow MT4 users. I have a simple logic in trading which in pseudo would be
This first if would be easy as if(OrdersTotal()==0) which means no pending or opened orders in the order pool, which is what I need.
But the second if and third are tricky cause I'd like to check "opened" orders are long or short not just orders(which include pending orders). How should I do this?