Lean icon indicating copy to clipboard operation
Lean copied to clipboard

Adds MaximumRecoveryTime Portfolio Statistics

Open AlexCatarino opened this issue 5 years ago • 5 comments
trafficstars

Expected Behavior

Funds understand that all algorithms experience drawdowns, and the smaller, the better, but the recovery time is especially important. An algorithm that is in a sustained drawdown for more than 6-months most likely won't be traded by a fund and would likely be dropped if this occurs in live trading. (source)

Actual Behavior

No statistics on the maximum recovery time.

Potential Solution

Implement such measurement.

Checklist

  • [x] I have completely filled out this template
  • [x] I have confirmed that this issue exists on the current master branch
  • [x] I have confirmed that this is not a duplicate issue by searching issues

AlexCatarino avatar Jul 18 '20 00:07 AlexCatarino

@jaredbroad I took a quick look at the codebase. Would this be implemented in Common\Statistics\Statistics.cs and then added to the StatisticsBuilder ?

I think I would also have to add a ReportElement and feed the statistic with data in Report.cs (backtestresult and/or liveresult), correct?

swisstackle avatar Aug 09 '24 00:08 swisstackle

Yes perfect @swisstackle, to make it show in the footer of the backtest view it would need to end up in the Dictionary here.

jaredbroad avatar Aug 09 '24 10:08 jaredbroad

@jaredbroad Do you have a formal definition of maximum recovery time?

With daily prices {100, 98,99,98,99}, is the maximum recovery time non-existent or 1 day?

I'm asking because if it's 1 day, the statistic seems useless in scenarios like {100,98, 99,98,99,50,0}, where the strategy never truly recovers, yet the maximum recovery time would still be 1 making it look good.

swisstackle avatar Aug 15 '24 00:08 swisstackle

@swisstackle We think the right answer is for it to return null/inf in your example above; the view might need to be adjusted to handle the inf/null values but if you make the PR return the correct value we'll handle the rest.

jaredbroad avatar Aug 19 '24 14:08 jaredbroad

@jaredbroad Ok, when I get time to work on this, I will go for the "recovery time of the maximum drawdown" which fits your description and then we can make adjustments later.

swisstackle avatar Aug 19 '24 15:08 swisstackle