def bollinger_band_indicator(price, syms = ['AAPL'], lookback = 21):
sma = sma_indicator(price)
#price = compute_prices()
###calculate bolling bands(21 day) over the entire period
rolling_std = price.rolling(window = lookback, min_periods = lookback).std()
#rolling_std = pd.rolling_std(price, window = lookback, min_periods = lookback)
top_band = sma + (2 * rolling_std)
bottom_band = sma - (2 * rolling_std)
bbp = (price - bottom_band) / (top_band - bottom_band)
bbp = bbp.fillna(method = 'bfill')
return bbp,top_band, bottom_band
###Calculate relative strength, then RSI
indicators.py 文件源码
python
阅读 29
收藏 0
点赞 0
评论 0
评论列表
文章目录