talib 不是万能的、有些其它指标 如:BBI、PSY、BIAS等这些指标是没有的
def BBI(df, n1=3, n2=6, n3=12, n4=24):""" 多空指数 """ bbi = (MA(df["close"], n1) + MA(df["close"], n2) + MA(df["close"], n3) + MA(df["close"], n4)) / 4 new_df = pd.DataFrame(data=list(bbi), columns=["bbi"])return new_df
def PSY(df, n=12, m=6):""" 心理线 """ new_df = pd.DataFrame()
new_df["psy"] = COUNT(df["close"] > df["close"].shift(1), n) / n * 100 new_df["psyma"] = MA(new_df["psy"], m)return new_df
new_df["psy"] = COUNT(df["close"] > df["close"].shift(1), n) / n * 100 new_df["psyma"] = MA(new_df["psy"], m)return new_df
def BIAS(df, n=6):""" 乖离率 """ ma1 = MA(df["close"], n)
new_df = pd.DataFrame(data=list((df["close"] - ma1) /
new_df = pd.DataFrame(data=list((df["close"] - ma1) /