# Function to get Total Orders for one Symbol?

13

Hi all,

is there a function to get Total Open Orders for one Symbol only?
As far as I know TotalsOrder() will return all Open Orders for all symbols.

pob
152

As far as I know, there is no such function in the reference.

But you can easily build one yourself.
Make a loop on the orders pool, and if the current order symbol matches the chart symbol -> counter++.
1758

Pob
You will usually need a count by MagicNumber & OrderType as well as Symbol
So something like
```int OpenTradesForMNandPairType(int iMN, string sOrderSymbol, int iType)
{
int icnt, itotal, retval;

retval=0;
itotal=OrdersTotal();

for(icnt=0;icnt<itotal;icnt++) // for loop
{
// check for opened position, symbol & MagicNumber
if (OrderSymbol()== sOrderSymbol)
{
if (OrderMagicNumber()==iMN)
{
if(OrderType()==iType) retval++;
}
} // sOrderSymbol
} // for loop

return(retval);
}
```

FWIW
-BB-
13

Thanks a lot guys!

:)

1672

pob:
Hi all,

is there a function to get Total Open Orders for one Symbol only?
As far as I know TotalsOrder() will return all Open Orders for all symbols.