Why no HistoryPosition functions?

 

Hello all.

Short version: 

I've read everything I can find on this. Particularly the MQL5 Reference > Trade Functions, and this awesome article (ORDERS, POSITIONS AND DEALS IN METATRADER 5).

We have Functions for active orders, active positions, history orders, and history deals.

Why don't we have any functions for history positions?

Thanks!


.

.

.

.

.



A little more detail (ignore this if you want, mostly just for interest and to be thorough): 

  • We have: (1) Orders, (2) Deals, and (3) Positions -- entities or whatever we want to call them, and...
  • We have... let's call them statuses: they're either (A) active (opened but not closed) or (B) historical (opened, then closed -- done).

So every combination of those is these six: 

  • Active Orders
  • Active Deals
  • Active Positions
  • History Orders
  • History Deals
  • History Positions

Except Active Deals doesn't make sense because a orders and positions have a start and end, a life over an interval of time, but a deal is a single event: a moment in time. No start and end, so never "active".

So we should have five: Active Orders and Positions, and History Orders, Deals, and Positions.

And in MQL5 we have comprehensive functions for four of those (Active Orders and Positions, History Orders and Deals).

Why no functions for History Positions?



Documentation on MQL5: Trade Functions
Documentation on MQL5: Trade Functions
  • www.mql5.com
Trade Functions - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
David _Detnator_ :

You must independently collect the "HISTORIC POSITION" from the "historical trades". I once wrote an example: Reconstruction of positions

Reconstruction of positions
Reconstruction of positions
  • www.mql5.com
An example of working with the trading history on Hedge accounts — reconstruction of positions.
 
Vladimir Karputov #:

You must independently collect the "HISTORIC POSITION" from the "historical trades". I once wrote an example: Reconstruction of positions


Not sure why I didn't reply to this earlier.  Thought I did.  My apologies.

Needless to say, thanks for the answer, and for the code. That's pretty neat!

Seems kind of odd that we have to do this ourselves...?  I'm confused as to why it isn't built in alongside all the others.  But still, at least there's a solution one way or another.

Thanks again!