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



  • 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



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



  • Hi ab_trader,

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

    Thanks


Log in to reply
 

});