Count the total losses in the historic :

Code:
double countloss(datetime time){
   double loss=0;
   for(int j=OrdersHistoryTotal()-1;j>=0;j--){
      if(!OrderSelect(j,SELECT_BY_POS,MODE_HISTORY))continue;
         if(OrderMagicNumber()==Magic)
            if(OrderSymbol()==Symbol())
               if(OrderOpenTime()>=time)
                  if(OrderProfit()<0)loss+=OrderProfit()/(OrderLots()*10);
   }
   return(loss);
}