MCPcopy Index your code
hub / github.com/kernc/backtesting.py / _plot_drawdown_section

Function _plot_drawdown_section

backtesting/_plotting.py:414–426  ·  view source on GitHub ↗

Drawdown section

()

Source from the content-addressed store, hash-verified

412 figs_above_ohlc.append(fig)
413
414 def _plot_drawdown_section():
415 """Drawdown section"""
416 fig = new_indicator_figure(y_axis_label="Drawdown", height=80)
417 drawdown = equity_data['DrawdownPct']
418 argmax = drawdown.idxmax()
419 source.add(drawdown, 'drawdown')
420 r = fig.line('index', 'drawdown', source=source, line_width=1.3)
421 fig.scatter(argmax, drawdown[argmax],
422 legend_label='Peak (-{:.1f}%)'.format(100 * drawdown[argmax]),
423 color='red', size=8)
424 set_tooltips(fig, [('Drawdown', '@drawdown{-0.[0]%}')], renderers=[r])
425 fig.yaxis.formatter = NumeralTickFormatter(format="-0.[0]%")
426 return fig
427
428 def _plot_pl_section():
429 """Profit/Loss markers section"""

Callers 1

plotFunction · 0.85

Calls 2

new_indicator_figureFunction · 0.85
set_tooltipsFunction · 0.85

Tested by

no test coverage detected