17 using System.Collections.Generic;
24 internal sealed
class MaxDrawdownReportElement : ReportElement
47 public override string Render()
51 var backtestDrawdown = _backtest?.
TotalPerformance?.PortfolioStatistics?.Drawdown;
53 return backtestDrawdown?.ToString(
"P1") ??
"-";
56 var equityCurve =
new SortedDictionary<DateTime, decimal>(DrawdownCollection.NormalizeResults(_backtest, _live)
58 .ToDictionary(kvp => kvp.Key, kvp => (decimal)kvp.Value));
60 var maxDrawdown = Statistics.Statistics.DrawdownPercent(equityCurve);
63 return $
"{maxDrawdown:P1}";