Navigation

    Backtrader Community

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/

    Problem with custom Indicator

    Indicators/Strategies/Analyzers
    2
    3
    171
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • K
      konny last edited by

      Hi guys,

      I'm trying to implement a indicator:

      class IFT(bt.Indicator):
      
        lines = ('ift',)
        plotlines = dict(ift=dict(color='black', ls='-', linewidth=1.5))
      
        def init(self):
      
           v = 0.1 * self.data
           self.l.ift = 100 * (np.exp(v) - 1) / (np.exp(v) + 1)
      
      
      class testStrategy(bt.Strategy):
      
        self.IFT = IFT(self.data)
      

      TypeError: 'numpy.ndarray' object is not callable

      Help will be appreciated.

      Thanks

      1 Reply Last reply Reply Quote 0
      • A
        ab_trader last edited by

        np.exp requires array as an argument and v is not an array.

        • If my answer helped, hit reputation up arrow at lower right corner of the post.
        • Python Debugging With Pdb
        • New to python and bt - check this out
        1 Reply Last reply Reply Quote 1
        • K
          konny last edited by

          Hi ab_trader,

          many thanks for the answer
          can you tell me how i convert self.data into array?

          Thanks

          1 Reply Last reply Reply Quote 0
          • 1 / 1
          • First post
            Last post
          Copyright © 2016, 2017, 2018, 2019, 2020, 2021 NodeBB Forums | Contributors