Daily profit this symbol and this magic

 

Hi everyone, I am using this function to return today's profit for a specific pair and specific magic number for today only.  but it seems to be totaling all magic numbers


Does anyone see where I might be going wrong?


double CCIDailyProfit()
{
  double CCIprofit = 0;
 
  int cnt4 = OrdersHistoryTotal();
  for (int i4=0; i4 < cnt4; i4++)   
  {
    if (OrderSelect(i4, SELECT_BY_POS, MODE_HISTORY) 
    &&  OrderSymbol() == Symbol() 
    &&  OrderMagicNumber() == CCI_Magic
    &&  TimeDayOfYear(OrderCloseTime()) == DayOfYear() 
    &&  TimeYear(OrderCloseTime()) == Year());
    CCIprofit += OrderProfit()+OrderSwap();
  }
 
  return (CCIprofit);
}
 
    &&  TimeYear(OrderCloseTime()) == Year());
Remove the semicolon
 
So helpful, thank you!!
Reason: