Get the Day Profit for MT5

 

I'm trying to get the Day profit for the current symbol and magic number using this code but getting a "HistoryDealGetInteger" no one of the overloads can be applied to the function call error.

What does that mean? How do I fix it?


Thanks

double DayProfit()
{
   double dayprof = 0.0;
   datetime end = TimeCurrent();
   string sdate = TimeToString (TimeCurrent(), TIME_DATE);
   datetime start = StringToTime(sdate);

   HistorySelect(start,end);
   int TotalDeals = HistoryDealsTotal();

   for(int i = 0; i < TotalDeals; i++)
   {
      ulong Ticket = HistoryDealGetTicket(i);

      if(HistoryDealGetInteger(Ticket,DEAL_ENTRY) == DEAL_ENTRY_OUT)
      {
        if( HistoryDealGetInteger(Ticket,DEAL_SYMBOL)== _Symbol )
         {
             if( HistoryDealGetInteger(Ticket,DEAL_MAGIC)== iMagicNumber)
            {
               double LatestProfit = HistoryDealGetDouble(Ticket, DEAL_PROFIT);
               dayprof += LatestProfit;
            }
         }
      }
   }
   //Print("DAY PROFIT: ", dayprof);
   return(dayprof);
}
 
if( HistoryDealGetInteger(Ticket,DEAL_SYMBOL)== _Symbol )

This is the error. You're calling HistoryDealGetInteger with an ENUM_DEAL_PROPERTY_STRING (DEAL_SYMBOL). Use HistoryDealGetString instead and you should be good. 

This error "no one of the overloads can be applied to the function call error" happens when you call a function with parameters of wrong type or with more/less than the actual expected number of parameters.
 
Emanuel Cavalcante Amorim Filho #:

This is the error. You're calling HistoryDealGetInteger with an ENUM_DEAL_PROPERTY_STRING (DEAL_SYMBOL). Use HistoryDealGetString instead and you should be good. 

This error "no one of the overloads can be applied to the function call error" happens when you call a function with parameters of wrong type or with more/less than the actual expected number of parameters.

Thanks.  I will try that!

 
Will be good.J am really new.