getting information of several postions
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
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?