'list' object is not callable : Error in Custom Indicator
-
I am creating one custom indicator and i want to assign a list object to lines.
self.lines.non_none_szs = self.non_none_sz
It is giving me following error:
File "/Users/saurabh/Python3/vs-py-venv/lib/python3.6/site-packages/backtrader/lineseries.py", line 79, in set
value = value(0)
TypeError: 'list' object is not callableI am stuck with this since last couple pf hours but not getting a way to assign a list object to lines array.
Any help here will be highly appreciated
-
We would like to help you but your question is not very informative. Please Include all of your code. Please also include the full log print out that has the error. Also please follow the instructions at the very top of this page for using three back ticks to wrap around your code.
For example:
put code here.
-
@run-out said in 'list' object is not callable : Error in Custom Indicator:
put code here.
Here goes my codeclass FiboFactors:
def init(self,x,a,b,c,d):
self.x = x
self.a = a
self.b = b
self.c = c
self.d = d
self.xab = (abs(b - a) / max(0.01, abs(x - a)))
self.xad = (abs(a - d) / max(0.01, abs(x - a)))
self.abc = (abs(b - c) / max(0.01, abs(a - b)))
self.bcd = (abs(c - d) / max(0.01, abs(b - c)))class Fibonn(Indicator):
alias = ('FIB', 'Fibonn',)
data = None
period = Nonelines = ('non_none_szs',) #params = (dict(period=1, safediv=True)) plotlines = dict( non_none_szs=dict(_name='CP', marker='v', markersize=6.0, ls='', color='pink', _skipnan=True), ) plotinfo = dict(subplot=True) def __init__(self,period,candle,interval,alt_time_frame,use_alt_timeframe): # self.data=data self.candle=candle self.period=period self.interval=interval self.alt_time_frame=alt_time_frame self.use_alt_timeframe=use_alt_timeframe self.setup() # Before super to ensure mixins (right-hand side in subclassing) # can see the assignment operation and operate on the line #self.lines.is_bat=self.is_bat(1) self.lines.non_none_szs = self.non_none_sz # for i in range(0, len(self.non_none_sz)): # self.lines.non_none_szs[0].append(bt.Max(0.0, self.non_none_sz[i])) #self.lines.non_none_szs = bt.Max(0.0, self.non_none_sz) super(Fibonn, self).__init__() def setup(self): sz=self.calculate_sz() non_none_sz = [sz[i] for i in range(0,len(sz)) if sz[i]] self.non_none_sz=non_none_sz if len(non_none_sz) >= 5: self.fibonums = FiboFactors(*non_none_sz[-5:]) self.lines.non_none_szs = self.non_none_sz # def apply(self): # # self.data.df['pandas_SMA_3'] = self.data.df.iloc[:,1].rolling(window=self.period).mean() # return self def calculate_sz(self): #alt_factor = alttf_to_tf_factor(interval=self.interval, altinterval=self.alt_time_frame) #grouped_candle = get_grouped_candles(self.candle, self.interval, self.alt_time_frame) alt_factor=1 grouped_candle=self.candle len_grouped_candle=len(self.candle.get('TIME')[0].array) sz = [None]*(alt_factor) for i in range(1, len_grouped_candle): nextsz = None if self.candle["isup"][0][i-1]==1.0 and self.candle["isdown"][0][i]==1.0 : nextsz = max(grouped_candle["High"][0][i], grouped_candle["High"][0][i-1]) elif self.candle["isdown"][0][i-1]==1.0 and self.candle["isup"][0][i]==1.0: nextsz = min(grouped_candle["Low"][0][i], grouped_candle["Low"][0][i-1]) else : nextsz = None sz += [nextsz] + [None]*(alt_factor-1) sz += [None]*(alt_factor-len(sz)) return sz
-
This post is deleted! -
@finnovesh-incorporation @run-out any help here will be quite appreciated
-
@finnovesh-incorporation @run-out please help me out ... SOS
-
@finnovesh-incorporation @run-out any update on this ?
-
I had a similar problem, so fuck.



-
I had a similar problem, so fuck.



-
I had a similar problem, so fuck.