Profit-loss
For the total profit-loss calculation (P&L) in a trading algorithm it is necessary to use the IPnLManager interface implementation, by way of PnLManager.
Prerequisites
The profit-loss calculation adding to the SampleSMA
You should add the text box for the P&L in the information output window:
<Label Grid.Column="0" Grid.Row="3" Content="P&L:" /> <Label x:Name="PnL" Grid.Column="1" Grid.Row="3" />
Next, you need to extend the event method-handler of the strategy parameter change:
this.GuiAsync(() => { Status.Content = _strategy.ProcessState; PnL.Content = _strategy.PnL; Slippage.Content = _strategy.Slippage; });