Skip to content

TA-Lib BBands Indicator in Backtrader Strategy Faild  #430

Open

Description

@mohammadtirex

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) 

`

Activity

  1. mrjbq7 commented on Jun 5, 2021

    @mrjbq7
    Member

    What is bt?

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

  2. mario4tier commented on Oct 24, 2026

    @mario4tier
    Member

    Fixed in #780: an abstract function now takes an int (or a numpy number) for a real parameter, as talib.func does, so BBANDS(..., nbdevup=2) works.

  3. added 2 commits that reference this issue on Oct 25, 2026
    2f44467
    d993398
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions