I would like to build some custom indicators for an Alpha Model. 

in this case I would like to replace a standard momentum indicator with a exponetial slope, like suggested by Andreas Clenow in his book.

Does someone have an clue why this is not working. During debugging I do not get any value for input.Close in the class for the custom indicator, but i'm just using this example which is similar

https://www.quantconnect.com/forum/discussion/3383/custom-indicator-in-python-algorithm/p1

Thanks

Carsten

from datetime import timedelta import numpy as np from scipy import stats from collections import deque class CustomSlope(PythonIndicator): def __init__(self, name, period): self.Name = name self.Time = datetime.min self.Value = 0 self.queue = deque(maxlen=period) # Update method is mandatory def Update(self, input): y= [np.log(float(data)) for data in input.Close] x = [range(len(y))] slope,r_value = stats.linregress(x,y)[0],stats.linregress(x,y)[2] return slope class MOMAlphaModel(AlphaModel): def __init__(self): self.mom = [] self.cslope = CustomSlope('custom', 100) if not self.cslope.IsReady: return def OnSecuritiesChanged(self, algorithm, changes): for security in changes.AddedSecurities: symbol = security.Symbol #self.mom.append({"symbol":symbol, "indicator":algorithm.MOM(symbol, 100, Resolution.Daily)}) algorithm.RegisterIndicator(symbol, self.cslope, Resolution.Daily) self.mom.append({"symbol":symbol, "indicator":self.cslope.Value}) def Update(self, algorithm, data): insights = [] ordered = sorted(self.mom, key=lambda kv: kv["indicator"].Current.Value, reverse=True)[:4] for x in ordered: symbol = x['symbol'] insights.append( Insight.Price(symbol, timedelta(1), InsightDirection.Up) ) return insights