I am trying to sum the output from a foreach statement. Specifically, I would like to sum the unrealized Profit and loss from each position in the account. I can get the code to print each positions PnL perfectly (see the code below) but that's where I get stuck. How to sum...
Any help will be appreciated.
current code:
foreach (Position pos in Account.Positions)
{
Print("PnL = $"+pos.GetUnrealizedProfitLoss(PerformanceUnit.Cur rency));
}
Comment