Documentation
MQL5 ReferenceTrade FunctionsHistoryDealSelect 

HistoryDealSelect

Selects a deal in the history for further calling it through appropriate functions. It returns true if the function has been successfully completed. Returns false if the function has failed. For more details on error call GetLastError().

bool  HistoryDealSelect(
   ulong  ticket      // Deal ticket
   );

Parameters

ticket

[in]  Deal ticket.

Return Value

Returns true if successful, otherwise false.

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. The list of orders and deals displayed in the "History" tab, depends on the depth of history that can be set manually or using the HistorySelect() function.

The HistoryDealSelect() function works with a timeout. If the requested data are already available, they are given immediately without waiting. Otherwise, the preparation of the requested data may take a fixed timeout of 3 seconds. Once the data are received, the function immediately stops and returns the result.

In most cases the result of the function execution will be given immediately and without any delay, but during re-connections, the specified timeout of 3 seconds provides the necessary time to wait for an update.

HistoryDealSelect() clears in a mql5-program the list of deals available for reference, and copies the single deal, if the the execution of HistoryDealSelect() has been completed successfully. If you need to go through all deals selected by the HistorySelect() function, you should better use HistoryDealGetTicket().

See also

HistorySelect(), HistoryDealGetTicket(), Deal Properties