Hi all -- extremely new to quantopian (and robinhood) but loving what I've found/learned already. I'm interested in messing with some moving averages and regressions but can't find a good starting point or examples of how to use them. I'm slugging through documentation (https://www.quantopian.com/research/Tutorials%20and%20Documentation) but any help/guidance is greatly appreciated! -MM
- exponential moving average
- linear regression
simple moving average: (found this one) sma = SimpleMovingAverage(inputs=[USEquityPricing.close], window_length=10)
pipe.add(sma, 'sma')hlc3, ap, esa (I'm assuming I have to port this to zipline from below?)
storage.ap = storage.get('ap', 0)
if storage.ap == 0:
ap = 0
else:
ap = np.array(storage.ap)
if storage.ap == 0:
C = 200
ap_one = [float( data.btc_usd[-(x + 1)].high +
data.btc_usd[-(x + 1)].low +
data.btc_usd[-(x + 1)].close
) / 3 for x in range(C,0,-1)][-C:]
ap_one = np.array(ap_one)
if ap == 0:
ap = ap_one
else:
ap = np.hstack((ap, ap_one))
hlc3 = float( data.btc_usd.high +
data.btc_usd.low +
data.btc_usd.close) / 3
ap = np.hstack((ap, hlc3))
esa = talib.MA(ap, timeperiod=n1, matype=1)
ap = ap.tolist()
storage.ap = ap[-1001:]
return esa
most important, some simple pine strategy executions:
strategy.entry("long", strategy.long, when = crossover(fire, water) and (fire <= bottom))
strategy.exit("exit", "long", when = ((fire >= water)) and (fire >= top))