Navigation

    Backtrader Community

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    1. Home
    2. CDubya
    For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/
    C
    • Profile
    • Following 0
    • Followers 0
    • Topics 0
    • Posts 3
    • Best 0
    • Groups 0

    CDubya

    @CDubya

    0
    Reputation
    1
    Profile views
    3
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    CDubya Unfollow Follow

    Latest posts made by CDubya

    • RE: How to optimize custom indicator parameters?

      @han-shen

      I could not get optstrategy to work

      so I put the cerebro calls inside of a loop that varies the parameters I send to the
      addstrategy call.

      posted in Indicators/Strategies/Analyzers
      C
      CDubya
    • RE: optstrategy AttributeError: module 'collections' has no attribute 'Iterable'

      @druculac

      OK, dunno what I'm missing on this. It seems I am unclear on how to "fix" the collections.iterable problem.

      I put in

      from collections.abc import Callable, Iterable

      and nothing changed. Python 3.1 and latest backtrader

      and all of this still comes our screaming in RED at me.

      File "C:/Users/cawort01/AppData/Local/Programs/Python/Python310/BT-Rookie_A.py", line 31, in <module>
      cerebro.optstrategy(firstStrategy, period=range(14,21))
      File "C:\Users\cawort01\AppData\Local\Programs\Python\Python310\lib\site-packages\backtrader\cerebro.py", line 895, in optstrategy
      vals = self.iterize(kwargs.values())
      File "C:\Users\cawort01\AppData\Local\Programs\Python\Python310\lib\site-packages\backtrader\cerebro.py", line 335, in iterize
      elif not isinstance(elem, collections.Iterable):
      AttributeError: module 'collections' has no attribute 'Iterable'

      what the hell am I misunderstanding??

      Chris

      posted in General Code/Help
      C
      CDubya
    • RE: Unable to feed my custom DataFrame to backtrader

      @ahmad-nazari

      Hello, I stumbled across backtader after creating a whole lot of PYTHON UDF's for Excel with XLWINGS (awesome library btw)

      thinking I was spiffy, I thought I'd use my existing code to create a dataframe to pass to Cerebro and use the already calculated indicators at my disposal. I didn't get it to work. so I just "rebuilt" the indicators in BT's INIT

      i am really really new to BackTrader. thinking starting last friday.

      This guy seems to have done it. his trading logic was off, but I think he has done what you're trying to do. I think the key is to structure the data so that Cerebro "knows" where to look for the values it is trying to work with.

      https://community.backtrader.com/topic/5217/simple-macd-strategy-with-long-short-and-close

      Good Luck. this is an astounding package. considering I used to do all of this years ago in C and C++ before TALIB existed.

      posted in General Code/Help
      C
      CDubya