I wand to add custom plot elements e.g. a box between buy and sell trades. The axis ax is normally created like this: fig, ax = plt.subplots()
How can I access it in Backtester’s plot?
ax = ???
width = (bt.num2date(self.sell_dt) - bt.num2date(self.buy_dt)).total_seconds() / (60*60*24)
height = self.sell_price - self.buy_price
rect = patches.Rectangle((self.buy_dt, self.buy_price), width, height, linewidth=1, edgecolor='yellow', facecolor='yellow', alpha=0.5)
ax.add_patch(rect)