how to get last closed order ticket number with MQL5?

 

I am newbie with mql5? Would like to know how to get last closed orders (market order closed or pending order deleted) ticket number?  

Thanks in advance.

 
XIn Li:

I am newbie with mql5? Would like to know how to get last closed orders (market order closed or pending order deleted) ticket number?  

Thanks in advance.

Basically you need to use these functions:

https://www.mql5.com/en/docs/trading/historyorderstotal
https://www.mql5.com/en/docs/trading/historyselectbyposition

https://www.mql5.com/en/docs/constants/tradingconstants/orderproperties


ENUM_ORDER_PROPERTY_INTEGER

ORDER_TIME_DONE

Order execution or cancellation time

datetime


Good luck.

Documentation on MQL5: Trade Functions / HistoryOrdersTotal
Documentation on MQL5: Trade Functions / HistoryOrdersTotal
  • www.mql5.com
Returns the number of orders in the history. Prior to calling HistoryOrdersTotal(), first it is necessary to receive the history of deals and orders using the HistorySelect() or HistorySelectByPosition() function. Do not confuse orders of a trading history with current...
 
Thanks. still a challenging to figure it out.
 
How get order properties (History)
How get order properties (History)
  • 2019.08.06
  • www.mql5.com
i want get order properties at history mq5 and select position. see picture. i'm sorry.i use english very bad. Thank you...
Reason: