for(int i = 0 ; i<PositionsTotal() ; i++) { long ticket = PositionGetTicket(i); // Use this line first to select the position double profit = PositionGetDouble(POSITION_PROFIT); // Once you select the position using PositionGetTicket(i) you can use PositionGetDouble() Print(ticket,"'s profit is ",profit); }
You need to select the position before get data, always call PositionGetTicket as first, then you can use PositionGetDouble to get the
position info
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
i want to know how to get information of several positions , for example how can i get the profit of 2 open positions
i'm using this code but it only gives me one of the position's profit.
for example i have ticket 42 with 16 profit and ticket 43 with 8 profit . and it writes 16 profit for both of them
any helps?