TA-Lib / ta-lib-python

Python wrapper for TA-Lib (http://ta-lib.org/).
http://ta-lib.github.io/ta-lib-python
Other
9.69k stars 1.76k forks source link

TA-Lib BBands Indicator in Backtrader Strategy Faild #430

Open mohammadtirex opened 3 years ago

mohammadtirex commented 3 years ago

Hello I am a new python user and got annoying error "" TypeError: Invalid parameter value for nbdevup (expected float, got int) "" When I use bt.talib.bband in my strategy class at backtrader .

What Should I do? Would you please help me. Here is my Initiation of strategy which error get occurred `import backtrader as bt import talib

class TestStrategy(bt.Strategy):

def __init__(self):  ## initialize function

    self.bb   = bt.talib.BBANDS(self.data.close, timeperiod = 14)
   #  or even  : a,b,c = bt.talib.BBANDS() 
   # or even   : a,b,c = bt.talib.BBANDS(self  or  self.data) 

`

mrjbq7 commented 3 years ago

What is bt?

The error is that you need to pass a float instead of an int to nbdevup.