Function to count all the open profits and losses :

Code:
//----------------------------------------------------- count profit

double countprofit(){
   double profit=0;
   for(int j=OrdersTotal()-1;j>=0;j--){
      if(!OrderSelect(j,SELECT_BY_POS))continue;
         if(OrderMagicNumber()==Magic)
            if(OrderSymbol()==Symbol())
                  profit=profit+((OrderProfit()+OrderCommission()+OrderSwap())/(Fixedlots*10));
   }
   return(profit);
}