Consecutive Win / loss count 0 to 10

 

Hi

I have a Consecutive win count function which is capped at 10.

I have just realised that it doesn't stop counting at zero - so i get minus numbers.

If there is a win i want to increment by one upto 10, and decrement by 1 down to zero.

This is the original code below - i have tried adding breaks / having a wincount and loss count and then adding them together, and various other iterations. I am sure this is going to be very obvious - but am stuck at the moment.

any suggestions?

int TotalConsecutiveWins()
  {
   int WinCount=0;
   for(int k=OrdersHistoryTotal()-1;k>=0;k--)
     {
      OrderSelect(k,SELECT_BY_POS,MODE_HISTORY);
      if(OrderSymbol()==Symbol() && OrderMagicNumber()==MagicNumber)
        {
         if(OrderProfit()>0) WinCount++; //&& (WinCount + EquityPercent) <10)
         else if(OrderProfit()<0) WinCount--;
        }
      WinCount=MathMin(WinCount,10);
     }
   return (WinCount);
  }