22 internal sealed
class CAGRReportElement : ReportElement
45 public override string Render()
47 var equityCurve = _live ==
null
48 ?
new Series<DateTime, double>(ResultsUtil.EquityPoints(_backtest))
49 : DrawdownCollection.NormalizeResults(_backtest, _live);
51 if (equityCurve.IsEmpty)
56 var years = (decimal)(equityCurve.LastKey() - equityCurve.FirstKey()).TotalDays / 365m;
58 Result = Statistics.Statistics.CompoundingAnnualPerformance(
59 equityCurve.FirstValue().SafeDecimalCast(),
60 equityCurve.LastValue().SafeDecimalCast(),
63 return ((decimal?)
Result)?.ToString(
"P1") ??
"-";