def aroon(df, aroon_per, aroon_sl, aroon_wl): df_aroon = df.ta.aroon(length=aroon_per) aroon_u, aroon_d = df_aroon.iloc[:, 0], df_aroon.iloc[:, 1] aroon_usl = ta.above_value(aroon_u, aroon_sl) # strenght in aroon up aroon_dsl = ta.above_value(aroon_d, aroon_sl) # strenght in aroon down aroon_uwl = ta.below_value(aroon_u, aroon_wl) # weakness in aroon up aroon_dwl = ta.below_value(aroon_d, aroon_wl) # weakness in aroon down aroon_usl.iloc[:aroon_per] = np.nan aroon_dsl.iloc[:aroon_per] = np.nan aroon_uwl.iloc[:aroon_per] = np.nan aroon_dwl.iloc[:aroon_per] = np.nan return aroon_usl, aroon_dsl, aroon_uwl, aroon_dwl
def mfi(df, mfi_per, mfi_ll, mfi_ul): mfi = df.ta.mfi(length=mfi_per) mfi_buy = ta.above_value(mfi, mfi_ul) mfi_sell = ta.below_value(mfi, mfi_ll) mfi_buy.iloc[:mfi_per] = np.nan mfi_sell.iloc[:mfi_per] = np.nan return mfi_buy, mfi_sell
def rsi(df, rsi_per, rsi_llv, rsi_ulv): s_rsi = df.ta.rsi(length=rsi_per) s_rsi.iloc[:rsi_per] = np.nan # ta includes first values rsi_ll = ta.below_value(s_rsi, value=rsi_llv) rsi_ul = ta.above_value(s_rsi, value=rsi_ulv) rsi_ll.iloc[:rsi_per] = np.nan rsi_ul.iloc[:rsi_per] = np.nan return rsi_ll, rsi_ul