Daily profit this symbol and this magic

Back to topics list To post a new topic, please log in or register
avatar
25
sdoppke 2015.08.31 21:00
 

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);
}
avatar
Moderator
3423
GumRai 2015.09.01 00:36 #
 
    &&  TimeYear(OrderCloseTime()) == Year());
Remove the semicolon
avatar
25
sdoppke 2015.09.01 23:32 #
 
So helpful, thank you!!
Back to topics list  

To add comments, please log in or register