Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Beginner's question - no Plot, please help #922

Closed
Helliott31 opened this issue Feb 25, 2023 · 2 comments
Closed

Beginner's question - no Plot, please help #922

Helliott31 opened this issue Feb 25, 2023 · 2 comments
Labels
duplicate This issue or pull request already exists

Comments

@Helliott31
Copy link

Helliott31 commented Feb 25, 2023

Hello, I'm very new to Python and backtesting.py, I'm sure this error has been sorted but I can't find where.
I'm simply trying to compute the example with the exact code given with the package
I get an empty plot as a result.

Expected Behavior

Get the same plot as in example

Actual Behavior

White screen with axis on the right of the html file

I also get the following warning:
BokehDeprecationWarning: Passing lists of formats for DatetimeTickFormatter scales was deprecated in Bokeh 3.0. Configure a single string format for each scale
/Users/michael/PycharmProjects/Carry_optimizer/venv/lib/python3.11/site-packages/backtesting/_plotting.py:250: UserWarning: DatetimeFormatter scales now only accept a single format. Using the first provided: '%d %b'
formatter=DatetimeTickFormatter(days=['%d %b', '%a %d'],

Steps to Reproduce

1.Run the following code

Run the following code:
from backtesting import Backtest, Strategy
from backtesting.lib import crossover

from backtesting.test import SMA, GOOG


class SmaCross(Strategy):
    def init(self):
        price = self.data.Close
        self.ma1 = self.I(SMA, price, 10)
        self.ma2 = self.I(SMA, price, 20)

    def next(self):
        if crossover(self.ma1, self.ma2):
            self.buy()
        elif crossover(self.ma2, self.ma1):
            self.sell()


bt = Backtest(GOOG, SmaCross, commission=.002,
              exclusive_orders=True)
stats = bt.run()
print(stats)
bt.plot()
python code goes here

Additional info

  • Backtesting version: 0.3.3
  • bokeh.3.0.3
  • OS: MacOS 12.5
@kernc
Copy link
Owner

kernc commented Feb 25, 2023

Duplicate of #803.

@kernc kernc closed this as not planned Won't fix, can't repro, duplicate, stale Feb 25, 2023
@kernc kernc added the duplicate This issue or pull request already exists label Feb 25, 2023
@Helliott31
Copy link
Author

Helliott31 commented Feb 25, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants