Skip to content

Invalid or erroneous drawdown calculations in equity plot for resampled datasets #162

Closed
@eervin123

Description

@eervin123

Expected Behavior

Plots, where data was resampled due to >10,000 bars, should calculate max drawdowns and drawdown periods similar to those computed in the _compute_stats method

Actual Behavior

It appears when plots are downsampled in the Backtest.plot(resample=True) the drawdown calculations and possibly drawdown duration (beginning and ending periods) are miscalculated.

Here are two examples of such charts:
https://www.realitysharesadvisors.com/fund_dash/fix_this_eth.html
https://www.realitysharesadvisors.com/fund_dash/fix_this.html

Note the legend in one of the charts showing 0 days of max drawdown
image

Here is an example where the red line is misplaced on an incorrect drawdown.
bokeh_plot (1)

Steps to Reproduce

  1. I was using 5-minute candles on multiple years of data.
  2. Run Backtest.plot() on a large dataset and it should reproduce the result...Hopefully, if not, I am happy to privately share my datafiles and strategy class for you to reproduce on your system.

Additional info

This was also referenced in a different issue #156 (comment)

  • Backtesting version: 0.2.3
  • bokeh 2.2.3
  • python 3.8.5
  • pandas 1.1.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions