How to check for closed trades

 
ok for some reason i cant figure out how to check the closed trades price.

I mean suppose you trade all day with dozens of closed trades and right now you ve got 2 open trades. And you decide to close the 1 of the 2.

How will you check the last one order when there are dozens of other trades in the history so you dont know where to start looking from.

Any sample code i can work with??

 
athanfx:
ok for some reason i cant figure out how to check the closed trades price.

I mean suppose you trade all day with dozens of closed trades and right now you ve got 2 open trades. And you decide to close the 1 of the 2.

How will you check the last one order when there are dozens of other trades in the history so you dont know where to start looking from.

Any sample code i can work with??

Does this help ? https://www.mql5.com/en/forum/146798
Reason: