Mql4 default Trade Functions OrdersTotal () will return total amount of order at a time. But if you need to know how many orders of specific type (BUY, SELL etc.) are open in your mt4 platform you can use following short code in your EA.
How to use this functions?
Example:
You just need to call function OrderCount(0); in your EA for individual open positions;
void OnTick(){Comment( “You have total “+OrderCount(0)+” BUY Orders\n”,
“You have total “+OrderCount(1)+” SELL Orders\n”,
“You have total “+OrderCount(2)+” BUYLIMIT Orders\n”,
“You have total “+OrderCount(3)+” SELLLIMIT Orders\n”,
“You have total “+OrderCount(4)+” BUYSTOP Orders\n”,
“You have total “+OrderCount(5)+” SELLLSTOP Orders”);
}
Thank from