Any OrderCloseTime function for 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,

Man

 

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.

 
Man: Does anyone know is there any substitutes for OrderCloseTime() in MQL5?
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);


 
Vladimir Karputov:

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.


Thanks Vladimir.

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?

 
whroeder1:
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:



Great info, thanks whroeder1.

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());
        }
}
 
Man:

Thanks Vladimir.

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?


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


Note, here it is a question of DEALS (Basic Principles)

Basic Principles - Trading Operations - MetaTrader 5 Help
Basic Principles - Trading Operations - MetaTrader 5 Help
  • www.metatrader5.com
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...
 

Forum on trading, automated trading systems and testing trading strategies

Any OrderCloseTime function for MQL5?

Man, 2017.07.20 04:02


Great info, thanks whroeder1.

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());
        }
}
SELECT_BY_POS
 

cool posts , thanks for the posts and replies