Navigation

    Backtrader Community

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

    Topics created by Giacomo

    • G

      Turtle strategy - boolean error
      General Code/Help • • Giacomo

      3
      0
      Votes
      3
      Posts
      327
      Views

      run-out

      @Giacomo said in Turtle strategy - boolean error:

      closes = []

      You are using closes = [] as a global variable. You need to move this into the init as:

      self.closes = list()

      This will make it a local variable to the Strategy class. Then change all the closes in next to self.closes.

      I made this change and it works fine.

      You may wish to consider using self.datas[0].close.get(ago=1, size=??) instead of min(self.closes[-self.params.interval - 1:-1])

      Or even better setting up local_min/local_max as indicators in init using bt.ind.MaxN and bt.ind.MinN

    • G

      Cerebro.plot() causing Process finished with exit code 139 ?
      General Code/Help • • Giacomo

      2
      0
      Votes
      2
      Posts
      98
      Views

      vladisld

      It looks like the csv file has some abnormal data - hard to tell without having a full file. Running your code on a short sample you've provided does not reproduce the above failure.

    • G

      GenericCSVData - 'Cerebro' object has no attribute '_exactbars'
      General Code/Help • • Giacomo

      6
      0
      Votes
      6
      Posts
      184
      Views

      G

      Solved

      self.rsi = bt.indicators.RSI_SMA(self.data.close, period=self.params.period, safediv=True)
    • 1 / 1