i want an indicator to plot on lower chart, which will show a line (starting from 0) how the profit/loss, like any typical oscillator line.
very simple, i think.
I've found this snippet, but cant make it work:
double proft=0;
foreach (Account acct in Cbi.Globals.Accounts)
{
if (acct.Positions != null)
{
PositionCollection positions = acct.Positions;
foreach (Position pos in positions)
{
proft += pos.GetProfit();
//Print(pos.Account.Name + " " + pos.Instrument + " " + pos.MarketPosition + " " + pos.Quantity + " " + pos.AvgPrice);
}
}
}
Plot0.Set(proft);
this one says error , that Performance object not found):
print(Performance.AllTrades.TradesPerformance.Gros sProfit);

Comment