Skip to content

Possible bug bt.plot(show_legend=False) #204

Closed
@eervin123

Description

@eervin123

Expected Behavior

Plot output to browser should look almost the same with or without bt.plot(show_legend=False).

When I run bt.plot() my output looks as expected.
image

Actual Behavior

When run bt.plot(show_legend=False) my output is slow to load and comes out distorted.
example picture here.
image

Steps to Reproduce

from backtesting import Backtest, Strategy
from backtesting.lib import crossover

from backtesting.test import SMA, GOOG


class SmaCross(Strategy):
    n1 = 10
    n2 = 20

    def init(self):
        close = self.data.Close
        self.sma1 = self.I(SMA, close, self.n1)
        self.sma2 = self.I(SMA, close, self.n2)

    def next(self):
        if crossover(self.sma1, self.sma2):
            self.buy()
        elif crossover(self.sma2, self.sma1):
            self.sell()


bt = Backtest(GOOG, SmaCross,
              cash=10000, commission=.002,
              exclusive_orders=True)

output = bt.run()
bt.plot(show_legend=False)

Additional info

I am using backtesting version 0.3.0
bokeh is version 2.2.1
Browser is chrome

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