OrderCloseTime () in MQL5?

To add comments, please log in or register
Fabio Fontes
53
Fabio Fontes  
OrderOpenTime () is ORDER_TIME_SETUP

I already looked at

OrderGetInteger ()
HistoryOrderGetInteger ()

But it's all confusing.
Marco vd Heijden
Moderator
12720
Marco vd Heijden  
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...
fxsaber
15714
fxsaber  

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

Fabio Fontes
53
Fabio Fontes  
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
Fabio Fontes
53
Fabio Fontes  

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


thanks

fxsaber
15714
fxsaber  
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);
}
To add comments, please log in or register