OrderCloseTime () in MQL5?

 
OrderOpenTime () is ORDER_TIME_SETUP

I already looked at

OrderGetInteger ()
HistoryOrderGetInteger ()

But it's all confusing.
 
Documentation on MQL5: Trade Functions / PositionGetInteger
Documentation on MQL5: Trade Functions / PositionGetInteger
  • www.mql5.com
The function returns the requested property of an open position, pre-selected using PositionGetSymbol or PositionSelect. The position property should be of datetime, int type. There are 2 variants of the function. 2. Returns true or false, depending on the success of the function execution. If successful, the value of the property is placed in...
 

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();
  }
}
 
Fabio Fontes: OrderOpenTime () is ORDER_TIME_SETUP But it's all confusing.
Migrating from MQL4 to MQL5 - MQL5 Articles № 18
 
Thanks for the answer

But I only saw POSITION_TIME that would probably be OrderOpenTime ()

Unfortunately I could not find anything equivalent to OrderCloseTime () in Position Properties

 
fxsaber:

Yes, it's a great job, I tested it and it works.

I had looked before, was seeking to do without it.


But thanks
 

I had also looked at this article but did not see any reference to functions related to Order


thanks

 
Fabio Fontes:

I had looked before, was seeking to do without it.

datetime OrderCloseTime( const ulong Ticket )
{
  return((HistoryOrderGetInteger(Ticket, ORDER_TICKET) == Ticket) || HistoryOrderSelect(Ticket) ? (datetime)HistoryOrderGetInteger(Ticket, ORDER_TIME_DONE) : 0);
}
Reason: