Function to get Total Orders for one Symbol?

 
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.

Thanks in advance
pob
 
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++.
 
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
     {
      OrderSelect(icnt, SELECT_BY_POS, MODE_TRADES);
       // check for opened position, symbol & MagicNumber
       if (OrderSymbol()== sOrderSymbol)
        {
          if (OrderMagicNumber()==iMN) 
            {
              if(OrderType()==iType) retval++;
            }       
        } // sOrderSymbol
     } // for loop

return(retval);
}

FWIW
-BB-
 
Thanks a lot guys!

:)

 
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.

Thanks in advance
pob

mt4 standars indicatore iExposure.mq4

https://www.mql5.com/en/charts/9147694/usdcad-m5-alnus-yatirim-menkul

Chart USDCAD, M5, 2018.09.20 11:03 UTC, Alnus Yatirim Menkul Degerler A.S., MetaTrader 4, Demo
Chart USDCAD, M5, 2018.09.20 11:03 UTC, Alnus Yatirim Menkul Degerler A.S., MetaTrader 4, Demo
  • www.mql5.com
Symbol: USDCAD. Periodicity: M5. Broker: Alnus Yatirim Menkul Degerler A.S.. Trading Platform: MetaTrader 4. Trading Mode: Demo. Date: 2018.09.20 11:03 UTC.