Value of profit of open orders

 
I've tried searching for this, but I can't find an answer....

Can somebody tell me how to get the total value of all currently open positions. If I understand correctly, AccountProfit() gives the total profit/loss for the account as a whole. I just want the total profit/loss of open positions.

Can this be done, and if so, how?

Thanks
 
I've tried searching for this, but I can't find an answer....

Can somebody tell me how to get the total value of all currently open positions. If I understand correctly, AccountProfit() gives the total profit/loss for the account as a whole. I just want the total profit/loss of open positions.

Can this be done, and if so, how?

Thanks


I am sure that AccountProfit() returns the profit of opened positions.
Try it ! Put a print(AccountProfit()); somewhere and see what is printed...

otherwise, do a loop to compute it :
  double Profit = 0; 
  for(cnt = 0; cnt < OrdersTotal(); cnt ++)   
   {
      if (!OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES)) continue;    
      Profit += OrderProfit();
   }
 
Thank you for your help. I'll try AccountProfit(). The method using the loop is great too. Even if AccountProfit() works, I'll be able to modify the loop code to do other things.

Thanks again.