kernc
kernc
What's the issue here? The chart looks correct, no?
Indeed, the dotted tractor beams indicate trade durations and are currently non-optional: https://github.com/kernc/backtesting.py/blob/65f54f6819cac5f36fd94ebf0377644c62b4ee3d/backtesting/_plotting.py#L489-L496 In simple DCA test runs, you might skip plotting them? :stuck_out_tongue:
You can plot a single line by way of vectors of all _y_ s: ```py def init(self): support = 30000 self.I(lambda: np.repeat(support, len(self.data)), name='support line')
This is the relevant code part. https://github.com/kernc/backtesting.py/blob/1ee5670d03b26680d9add5c96a9f98e44fc722a2/backtesting/_plotting.py#L423-L445 I wonder what ```py import pandas as pd df: pd.DataFrame # your OHLC data pd.DatetimeIndex(df.index).resolution # ? ``` returns for your data?
@sedna16 Can you show a small, couple-lines example dataframe/index where this fails? I don't quite get this part: > doenst work > stockcode - NASDAQ:TSLA > date format - strftime('%Y-%m-%d')
Ok, the bug is due to weird timestamps: ``` ... 2021-01-27 14:30:00 2021-01-28 14:30:00 2021-01-29 21:00:02 #
Indeed, a small sample of the data with which to reproduce the bug sure would help.
Just to be sure, what is you pandas version and can you do `pip install -U pandas`?
Aparently, there's a pandas bug here for your input: https://github.com/kernc/backtesting.py/blob/94d20da85e278102a0cc71b27a3a35b815e11648/backtesting/_stats.py#L12-L24 Maybe you can investigate it by placing [`breakpoint()`](https://www.alpharithms.com/python-breakpoint-built-in-function-410212/) before the line: ```py df = df.reindex(dd.index) ``` and see what we...
> But I am not sure whether that would cause any other issue. I appreciate any help you can provide! It's that I'm not either. I think there are other...