How to find the last opened trade

How can I find the last open trade (the newest opened trade )

With the following two assumptions, you can get the last opened position as below

  • Ticket number being sequential
  • Highest position index used internally by MT5 = last added position.
PositionSelectByTicket(PositionGetTicket(PositionsTotal()-1));

More info:

Thank you I will try it

1 Like