HistoryDealsTotal

Returns the number of deal in history. Prior to calling HistoryDealsTotal(), first it is necessary to receive the history of deals and orders using the HistorySelect() or HistorySelectByPosition() function.

int  HistoryDealsTotal();

Return Value

Value of the int type.

Note

Do not confuse orders, deals and positions. Each deal is the result of the execution of an order, each position is the summary result of one or more deals.

Example:

//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
//--- request all the existing history on the account
   if(!HistorySelect(0TimeCurrent()))
     {
      Print("HistorySelect() failed. Error "GetLastError());
      return;
     }
 
//--- get the number of deals in the list and display it in the journal
   int total=HistoryDealsTotal();
   Print("Number of historical deals on the account: "total);
   /*
   result:
   Number of historical deals on the account339
   */
  }

See also

HistorySelect(), HistoryDealGetTicket(), Deal Properties