Hello @Rubén-Briones, if you are just trying to save the chart, here's the code:
def saveplots(cerebro, numfigs=1, iplot=True, start=None, end=None,
width=16, height=9, dpi=300, tight=True, use=None, file_path = '', **kwargs):
from backtrader import plot
if cerebro.p.oldsync:
plotter = plot.Plot_OldSync(**kwargs)
else:
plotter = plot.Plot(**kwargs)
figs = []
for stratlist in cerebro.runstrats:
for si, strat in enumerate(stratlist):
rfig = plotter.plot(strat, figid=si * 100,
numfigs=numfigs, iplot=iplot,
start=start, end=end, use=use)
figs.append(rfig)
# this blocks code execution
# plotter.show()
for fig in figs:
for f in fig:
f.savefig(file_path, bbox_inches='tight')
return figs
cerebro.plot(style = 'candlestick')
saveplots(cerebro,file_path = 'savefig.png')