How to get the latest open position? - page 2

 
MAD1995:

Can You please elaborate, i'm just learning how to code. I just need the value of last open price to make a condition for closing orders. Example is if the last open position is 100 pips below the current price it will execute the command to close all open positions. Thats all I need for the last open position.


Here is a good start:

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


Begin with PositionsTotal()

continue with PositionSelectByTicket()

then follow docs on PositionGet***()

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
 
Dominik Egert:


Here is a good start:

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


Begin with PositionsTotal()

continue with PositionSelectByTicket()

then follow docs on PositionGet***()

i'll try sir thanks.

Reason: