Count only sell and buy orders :

Code:
//----------------------------------------------------- count all

int count(int ordertype){
   int ordercount=0;
   for(int j=OrdersTotal()-1;j>=0;j--){
      if(!OrderSelect(j,SELECT_BY_POS))continue;
      if(OrderType()==ordertype)
         if(OrderMagicNumber()==Magic)
            if(OrderSymbol()==Symbol())ordercount++;
   }
   return(ordercount);
}