How get order history positions (MQL5)

 

i want time close order.

thank you.

Files:
timeclose.png  74 kb
 

Hi,

Maybe this can help you, just read the deal history and filter by OUT deals, then just read the deal time.


#include <Trade\OrderInfo.mqh>
#include <Trade\DealInfo.mqh>

...

COrderInfo orderInfo;
CDealInfo dealInfo;

...

HistorySelect(0,TimeCurrent());
for(int pos=HistoryDealsTotal()-1; pos>=0; pos--)
{
    if(dealInfo.SelectByIndex(pos))
    {
        // Read deal out and get deal time
        if(dealInfo.Entry()==DEAL_ENTRY_OUT && dealInfo.Symbol()==Symbol())
        {   
            datetime close_time = dealInfo.Time();          
        }
    }
}
 
Edwin Hernando Artunduaga Quiñonez:

Hi,

Maybe this can help you, just read the deal history and filter by OUT deals, then just read the deal time.


Thank you.