https://www.quantopian ema code example
Example: https://www.quantopian ema
def EMA(length, inputs=USEquityPricing.close, mask=QTradableStocksUS()):
return (
ExponentialWeightedMovingAverage(
inputs=[inputs],
window_length=length,
mask=mask,
decay_rate=(1 - (2.0 / (1 + length)))
)
)
class RSI_Score(CustomFactor):
inputs=[RSI]
window_length=1
def compute(self, today, assets, out, rsi):
rsi_ema = EMA(21, rsi)
out[:] = rsi_ema