I want get total AccountInfoDouble(ACCOUNT_PROFIT), but for a symbol()

 

I want get total AccountInfoDouble(ACCOUNT_PROFIT), but for a symbol()

 

Thank you 

 
Marketplace has a handy utility that is free that does this: KL Account Performance.  It is free.
 
double SymbolProfit(string symb){ 
   int cnt, total; 
   double BuyProfit = 0;
   double SellProfit = 0;
 
   total = OrdersTotal(); 

   for(cnt=0; cnt<total; cnt++){ 
      if(OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES)==true)
         if(OrderSymbol()==symb && OrderMagicNumber()==MagicNo){
            if(OrderType()==OP_BUY){
               BuyProfit = BuyProfit + OrderProfit() + OrderCommission() + OrderSwap(); 
            }   
            if(OrderType()==OP_SELL){
               SellProfit = SellProfit + OrderProfit() + OrderCommission() + OrderSwap(); 
            }   
         }      
   }
   return(BuyProfit+SellProfit);
}
 

Michael Maggi:
Marketplace has a handy utility that is free that does this: KL Account Performance.  It is free.

Michael Maggi:
Marketplace has a handy utility that is free that does this: KL Account Performance.  It is free.

I want in code mql, but, Thank you. 

 
Osama Shaban:
Thank you, it's working :)
 
Osama Shaban:

I modified...

 

double PLPAR(){ 

   int cnt, total; 

   double BuyProfit = 0;

   double SellProfit = 0;

   total = OrdersTotal(); 

   for(cnt=0; cnt<total; cnt++){     

      if(OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES)==true)

      if(OrderSymbol()!=Symbol()) continue;      

         {

            if(OrderType()==OP_BUY){

               BuyProfit = BuyProfit + OrderProfit() + OrderCommission() + OrderSwap(); 

            }   

            if(OrderType()==OP_SELL){

               SellProfit = SellProfit + OrderProfit() + OrderCommission() + OrderSwap(); 

            }   

         }      

   }

   return(BuyProfit+SellProfit);

Reason: