How to get History Order Close Time in MQL5

To add comments, please log in or register
Ashok Nale
678
Ashok Nale  

Can anyone tell me how I can get Order Close time for any closed order in History?

I tried HistoryOrderGetInteger(tktNum, ORDER_TIME_DONE) But it gives me order opening time which is the first column in History tab of MT5. I want the time which is specified in "Time" column of history tab in MT5.


Please let me know.

fxsaber
10635
fxsaber  
Ashok Nale
678
Ashok Nale  

Nope. It does not give me close time of the order.

I want to know equivalent of OrderCloseTime() in MQL4 to corresponding command in MQL5.

fxsaber
10635
fxsaber  
Ashok Nale:

I want to know equivalent of OrderCloseTime() in MQL4 to corresponding command in MQL5.

Forum on trading, automated trading systems and testing trading strategies

OrderCloseTime Expert Advisor MQL5

fxsaber, 2018.07.05 22:39

#include <MT4Orders.mqh> // https://www.mql5.com/en/code/16006

void OnStart()
{
  if (OrderSelect(OrdersHistoryTotal() - 1, SELECT_BY_POS, MODE_HISTORY))
  {
    Print(OrderCloseTime());
    
    OrderPrint();
  }
}

or

Forum on trading, automated trading systems and testing trading strategies

OrderCloseTime () in MQL5?

fxsaber, 2018.07.18 03:51

datetime OrderCloseTime( const ulong Ticket )
{
  return((HistoryOrderGetInteger(Ticket, ORDER_TICKET) == Ticket) || HistoryOrderSelect(Ticket) ? (datetime)HistoryOrderGetInteger(Ticket, ORDER_TIME_DONE) : 0);
}
To add comments, please log in or register