/// <summary> /// Call this at the end to add any open drawdowns to the drawdown length /// </summary> public void CalcFinalValues(DateTime dt) { if (DrawdownPct.Last() < -0.0000001) { DrawdownLengths.Add(dt - _drawdownStart); } }
private void AddDrawdownLengths(DateTime dt) { if (Returns.Count > 1 && DrawdownPct[DrawdownPct.Count - 2] < -0.0000001 && DrawdownPct.Last() > -0.0000001) { DrawdownLengths.Add(dt - _drawdownStart); } if (DrawdownPct.Last() < -0.000001 && (Returns.Count <= 1 || DrawdownPct[DrawdownPct.Count - 2] > -0.000001)) { _drawdownStart = dt; } }