Here is the code that I wrote.
protected override void Initialize()
{
DataSeries profit = new DataSeries(this);
double profitloss = profit.Indicator.Strategy.Position.GetProfitLoss(Close[0], PerformanceUnit.Currency);
Add(SMA(profitloss, Sma8));
CalculateOnBarClose = true;
}

Comment