Help me in Using OrdersTotal()

 

Please help me to use OrdersTotal() function to calculate specific trade by specific magic number 

OrdersTotal() function usually retrieve total numbers of trade either those are executed by different EA or manual

I want to get numbers of trade executed by specific ea with specific magic number. 

Thanks in advance 

 
palashcr:

Please help me to use OrdersTotal() function to calculate specific trade by specific magic number 

OrdersTotal() function usually retrieve total numbers of trade either those are executed by different EA or manual

I want to get numbers of trade executed by specific ea with specific magic number. 

Thanks in advance 

Loop through all the open Orders,  check their MagicNumber() and count the ones that match.
 
RaptorUK:
Loop through all the open Orders,  check their MagicNumber() and count the ones that match.


Thanks RaptorUK for the Idea I tried with following but it also Get total trade running I only want specific magic number's trade.  
double TotalOrder(int magic)
  {   
   double GetTotalOrder = 0;
   for(int cnt = 0; cnt < OrdersTotal(); cnt++)
     {
       OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
       if(OrderMagicNumber() == magic)
         {
           GetTotalOrder += (OrdersTotal());
         }   
     }
   return(GetTotalOrder);
  }
 
 
palashcr:

Thanks RaptorUK for the Idea I tried with following but it also Get total trade running I only want specific magic number's trade.   

Yes it will,  why are you doing this ?

GetTotalOrder += (OrdersTotal());

 why not this ?

GetTotalOrder += 1;
 
Thanks WHRoeder for the link i got here many useful codes but I m not getting such which count trade for only specific magic. e.g i m using 2 ea for same pair in 2 chart i just count open trade which magic number is 12345
 
Yea RaptorUK you are right i got the correct number now. 
Reason: