FRENESDE

Plotting with cerebro.plot()

cerebro.plot() uses matplotlib to draw the price, the indicators declared in __init__, the executed orders and the capital curve. You call it after run().
Buy and sell markers should land where your rule expects them. The chart is a visual check: a buy in the wrong place often reveals a bug.
A few useful options: cerebro.plot(style='candlestick') for candles, volume=False to hide volume. To hide an indicator, write self.sma.plotinfo.plot = False.
A nice chart is not proof: it shows a single historical path. Robustness is checked on other periods and other markets.

Examples

Key terms

cerebro.plot()
Draws the backtest result
matplotlib
The Python charting library Backtrader uses
Capital curve
How the portfolio value evolves over time
Order marker
Symbol showing where an order was executed
Take the mission on Doji Academy

← Back to the index