Click or drag to resize

Equity curve

The S# provides the possibility to plot equity curves for further analysis of the trading algorithm work. The data for the curve obtained using the PnLManager class. This class calculates the current value, informing the algorithm about the changes through the StrategyPnLChanged event.

To calculate the curve parameters (maximum drawdown, Sharpe ratio, etc.) StatisticManager used. These parameters are stored in the StatisticManagerParameters property. Each parameter implements IPnLStatisticParameter, ITradeStatisticParameter, IOrderStatisticParameter or IPositionStatisticParameter interfaces. If you want a particular calculation parameter, you must implement one of these interfaces and add the parameter to the StatisticManagerParameters.

The use of the StrategyPnLChanged is shown in the backtesting section in the context of trading strategies:

_strategy.PnLChanged += () =>
    var data = new EquityData
        Time = _strategy.Trader.MarketTime,
        Value = _strategy.PnL,

    this.GuiAsync(() => _curveItems.Add(data));

The statistics manager is obtained through the StrategyStatisticManager property.

When the new data occur, the curve is drawn on the special EquityCurveChart chart. To start drawing a curve on this chart, you must call the EquityCurveChartCreateCurve method. The resulting collection is filled with data that is passed during processing the StrategyPnLChanged event.

The EquityCurveChart chart allows to draw multiple curves to be able to compare their profitability with each other. An example of this approach is shown in the optimization section.

The use of the StatisticParameterGrid visual panel, which allows to display StatisticParameterGridParameters parameters, is shown in the backtesting section.