We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
what i do:
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() bt.plot()
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() bt.plot()
reference: pandas-dev/pandas#57197
seems there is typo in _plot_superimposed_ohlc() function
def _plot_superimposed_ohlc(): """Superimposed, downsampled vbars""" time_resolution = pd.DatetimeIndex(df['datetime']).resolution resample_rule = (superimpose if isinstance(superimpose, str) else dict(day='ME', hour='D', minute='h', second='min', millisecond='s').get(time_resolution))
bokeh.__version__
The text was updated successfully, but these errors were encountered:
Please upgrade to pandas >= 2.2 or pass bt.plot(superimpose='M') or bt.plot(superimpose=False).
bt.plot(superimpose='M')
bt.plot(superimpose=False)
Sorry, something went wrong.
No branches or pull requests
Expected behavior
what i do:
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)
bt = Backtest(GOOG, SmaCross, commission=.002,
exclusive_orders=True)
stats = bt.run()
bt.plot()
Code sample
Actual behavior
[ValueError: Invalid frequency: ME]
reference: pandas-dev/pandas#57197
Additional info, steps to reproduce, full crash traceback, screenshots
seems there is typo in _plot_superimposed_ohlc() function
def _plot_superimposed_ohlc():
"""Superimposed, downsampled vbars"""
time_resolution = pd.DatetimeIndex(df['datetime']).resolution
resample_rule = (superimpose if isinstance(superimpose, str) else
dict(day='ME',
hour='D',
minute='h',
second='min',
millisecond='s').get(time_resolution))
Software versions
bokeh.__version__
:The text was updated successfully, but these errors were encountered: