Managing profit/loss for 2 open positions of same symbol

 
How can we manage 2 open positions of same symbol? The function PositionSelect() only takes the first open position! Does anybody have a solution to propose? Thk u
 
raj2301 :
How can we manage 2 open positions of same symbol? The function PositionSelect() only takes the first open position! Does anybody have a solution to propose? Thk u

To do this, you need to loop through the entire list of positions and apply the PositionGetTicket . An example of calculating POSITIONS and PENDING orders

Example: Calculate Positions and Pending Orders

How to start with MQL5
How to start with MQL5
  • 2020.03.12
  • www.mql5.com
This thread discusses MQL5 code examples. There will be examples of how to get data from indicators, how to program advisors...
 
Tank Vladimir Karputov:

To do this, you need to loop through the entire list of positions and apply the PositionGetTicket . An example of calculating POSITIONS and PENDING orders

Example: Calculate Positions and Pending Orders

Thank you. I will go through the coding to understand the logic applied.