ta-lib-python icon indicating copy to clipboard operation
ta-lib-python copied to clipboard

TA-Lib BBands Indicator in Backtrader Strategy Faild

Open mohammadtirex opened this issue 4 years ago • 1 comments

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) 

`

mohammadtirex avatar Jun 05 '21 13:06 mohammadtirex

What is bt?

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

mrjbq7 avatar Jun 05 '21 16:06 mrjbq7