Is there a OrderCloseTime function in MQL5?

Hi Everyone,

Does anyone know is there any substitutes for OrderCloseTime() in MQL5?

How can achieve the similar results in MQL5 as below?

for(int i = 0; i < NumOpenOrders ; i++)
     {
      if( ticket=OrderSelect( NumOpenOrders[i],SELECT_BY_TICKET ) > 0 )
        {    
         if( OrderCloseTime() > 0) Alert("Order is closed");
        }
     }

Regards,

If you do not access the trading account history, I recommend that you use “OnTradeTransaction”: find a deal whose DEAL_ENTRY property is “DEAL_ENTRY_OUT”; The “DEAL_TIME” property is the closing time.

Of course there is.

  1. You can use the MT4Orders.mqh directly ‘MT4Orders’ library by ‘fxsaber’ for MetaTrader 5 in the MQL5 Code Base
  2. Or look in the code and see:
MT4ORDERS::Order.ClosePrice = ::PositionGetDouble(POSITION_PRICE_CURRENT);

Thanks @jiannuzzia
Still trying to grasp the Deal types for MQL5.
Can I say that for DEAL_ENTRY_IN meaning opening of a ticket (in MQL4 sense) while DEAL_ENTRY_OUT is closing of a ticket?

Great info, thanks @hbroadberriem .

Unfortunately, using this method I can’t seems to get the right OrderCloseTime.


for(int i=0; i<OrdersTotal(); i++)
{
        if(OrderSelect(i,SELECT_BY_TICKET)>0 )
        {
                Print("Ticket: " + OrderTicket());
                Print("OrderCloseTime: " + OrderCloseTime());
        }
}

All these situations are described by values from the ENUM_DEAL_ENTRY enumeration. In order to receive this information about a deal, use the HistoryDealGetInteger()function with the DEAL_ENTRY modifier.

ENUM_DEAL_ENTRY

Identifier Description
DEAL_ENTRY_IN Entry in
DEAL_ENTRY_OUT Entry out
DEAL_ENTRY_INOUT Reverse
DEAL_ENTRY_OUT_BY Close a position by an opposite one

Before you proceed to study the trade functions of the platform, you must have a clear understanding of the basic terms: order, deal and position…

 for(int i=0; i<OrdersTotal(); i++)
{
        if(OrderSelect(i,SELECT_BY_TICKET)>0 )
        {
                Print("Ticket: " + OrderTicket());
                Print("OrderCloseTime: " + OrderCloseTime());
        }
}

SELECT_BY_POS

cool posts , thanks for the posts and replies

https://www.mql5.com/en/forum/280044#comment_8760223