SharmaVidhiHaresh / Backtesting-Trading-Strategies-with-Python

In this project, I had backtested the cross-over trading strategy on Google Stock from Jan 2016 to June 2020. By using historical time-series data, I had tested the Moving Average(MA) cross-over strategy and Relative Strength Index (RSI) strategy with a stop loss at a price that closes 2% or more below 10-day MA. I had plotted the equity curve with drawdowns and P&L, as well as volume, relative strength index (RSI), stock pricing chart and simple moving averages.
40 stars 13 forks source link

backtest.plot() is not working #1

Open rahulmr opened 3 years ago

rahulmr commented 3 years ago

backtest.plot() is not working

I am getting below error.

Traceback (most recent call last):
  File "D:\trading\angel_py\btpy_eg.py", line 85, in <module>
    backtest.plot()
  File "D:\Apps\Scoop\apps\python\current\lib\site-packages\backtesting\backtesting.py", line 1704, in plot
    plot(
  File "D:\Apps\Scoop\apps\python\current\lib\site-packages\backtesting\_plotting.py", line 591, in plot
    _plot_superimposed_ohlc()
  File "D:\Apps\Scoop\apps\python\current\lib\site-packages\backtesting\_plotting.py", line 445, in _plot_superimposed_ohlc
    raise ValueError('Invalid value for `superimpose`: Upsampling not supported.')
ValueError: Invalid value for `superimpose`: Upsampling not supported.
PS D:\trading\angel_py>
SaraStemPro commented 1 year ago

Hi, I think that you have already found the answer but you should add this to your data: data = data.iloc[:-1]

With this you drop the last row of your data because it shows the real time with other format.

Regards. Sara