OrderSelect 2 most recently opened positions

 
So I've been trying to wrap my mind around it, but how can I select the 2 most recently opened positions using OrderSelect? I would really appreciate it if someone could please paste in a script that I can work on. Bottomline is I need to get the prices of my last 2 opened trades.. Would appreciate your help.

thanks!

 

for(i=0; i<=1; i++)

{

OrderSelect(i,SELECT_BY_POS);

Print("Order Open Price for ",OrderTicket()," is ",OrderOpenPrice());

//.....or something else with these values

}

 
FXtrader2008:

for(i=0; i<=1; i++)

[...]

Isn't that going to return the prices of the two oldest positions, not the two most recent ones? In addition, it's not necessarily taking account of (a) pending orders, and (b) orders placed by other EAs.


Depending on whether "opened" means "filled" or just "placed", then a fuller answer is going to be something like the opposite of 'Selecting Order from 2 same symbols'.

 
Thanks for all your help guys! :)
Reason: