View only closed trading positions from history

 

Hi

With this we can see current orders and orders (positions) from history:

https://www.mql5.com/en/docs/trading/historyordergetticket

but I need to know which one are closed (MT5: __History View__) and wich are opened: MT5: __Trade View__

?!


BR

J.

Documentation on MQL5: Trade Functions / HistoryOrderGetTicket
Documentation on MQL5: Trade Functions / HistoryOrderGetTicket
  • www.mql5.com
"#ticket %d %s %G %s at %G was set up at %s => done at %s, pos ID=%d"                 ticket,                                   type,                                     initial_volume,                           symbol,                                   open_price,                               positionID               ...
 
long deal_entry   = HistoryDealGetInteger(deal_ticket, DEAL_ENTRY);

if(deal_entry == DEAL_ENTRY_OUT)
{
        // order is closed
}
 
Ludovico Mattiuzzo:

I test and Trade window have 3 positions ... but I get 7 positions with:

if(deal_entry == DEAL_ENTRY_OUT)

?!

 
You are confusing Orders, Positions and Deals. Please go read the docs about it
 
Ludovico Mattiuzzo:
You are confusing Orders, Positions and Deals. Please go read the docs about it

Yes... but:

Can I get code that list history positions like on MT5 (Toolbar - History) ..... with filter: 2days

??