Convert 'lines' object into 'Panads Series' for talib Indicators functions Input
-
def next(self): self.lines.CDLDARKCLOUDCOVER[0] = talib.CDLDARKCLOUDCOVER(self.data.open, self.data.high, self.data.low, self.data.close, penetration=0.1)
Error -
File "/Users/ayushsomani/PycharmProjects/pythonProject/OHLCBackTesting.py", line 61, in next
self.lines.CDLDARKCLOUDCOVER[0] = talib.CDLDARKCLOUDCOVER(self.data.open, self.data.high, self.data.low, self.data.close, penetration=0.1)
File "/Users/ayushsomani/PycharmProjects/pythonProject/venv/lib/python3.8/site-packages/talib/init.py", line 27, in wrapper
return func(*args, **kwargs)
TypeError: Argument 'open' has incorrect type (expected numpy.ndarray, got LineBuffer)Approach 1 -
I used the indexing but again an error is raised.def next(self): self.lines.CDLDARKCLOUDCOVER[0] = talib.CDLDARKCLOUDCOVER(self.data.open[0], self.data.high[0], self.data.low[0], self.data.close[0], penetration=0.1)
File "/Users/ayushsomani/PycharmProjects/pythonProject/OHLCBackTesting.py", line 61, in next
self.lines.CDLDARKCLOUDCOVER[0] = talib.CDLDARKCLOUDCOVER(self.data.open[0], self.data.high[0], self.data.low[0], self.data.close[0], penetration=0.1)
File "/Users/ayushsomani/PycharmProjects/pythonProject/venv/lib/python3.8/site-packages/talib/init.py", line 27, in wrapper
return func(*args, **kwargs)
TypeError: Argument 'open' has incorrect type (expected numpy.ndarray, got float)Approach 2 -
If I use these indicators using bt.talib, there is some issue in the timeperiod. IMO, the CDLDARKCLOUDCOVER just compares the current bar with the previous bar. When I use self.CDLDARKCLOUDCOVER = bt.talib.CDLDARKCLOUDCOVER(self.data.open, self.data.high, self.data.low, self.data.close, penetration=0.1), it is skipping first 11 bars data. I am not getting the behaviour of this Indicator (CDLDARKCLOUDCOVER).