backtesting.py
backtesting.py copied to clipboard
Plotting time axis misplaced
I'm watching a misplaced time axis for 1min OHLC candles. As seen in the image below, the minutes of the time axis do not match with that of the tooltip.
Actual Behavior
Steps to Reproduce
bt = Backtest(1minute_ohlc_candles, Strat)
bt.plot(plot_equity=True, superimpose=False, show_legend=True, plot_return=False, plot_drawdown=False)
- Backtesting version: 0.3.1
Can you maybe share the first 50 minutes of said data to investigate?
Yes sorry, my bad.
Binance_DASHUSDT_minute_10000_clean.csv.zip
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()
df = pd.read_csv("file.csv", index_col=0, parse_dates=True, infer_datetime_format=True)
bt = Backtest(df, SmaCross, commission=.0, exclusive_orders=True, cash=100000)
results = bt.run()
bt.plot(results=results, plot_equity=True, superimpose=False, show_legend=True, plot_return=False, plot_drawdown=False)
@kernc did you have a chance to look at it?