def AddIndicators(df): # Add Simple Moving Average (SMA) indicators df["sma7"] = SMAIndicator(close=df["Close"], window=7, fillna=True).sma_indicator() df["sma25"] = SMAIndicator(close=df["Close"], window=25, fillna=True).sma_indicator() df["sma99"] = SMAIndicator(close=df["Close"], window=99, fillna=True).sma_indicator() # Add Bollinger Bands indicator indicator_bb = BollingerBands(close=df["Close"], window=20, window_dev=2) df['bb_bbm'] = indicator_bb.bollinger_mavg() df['bb_bbh'] = indicator_bb.bollinger_hband() df['bb_bbl'] = indicator_bb.bollinger_lband() # Add Parabolic Stop and Reverse (Parabolic SAR) indicator indicator_psar = PSARIndicator(high=df["High"], low=df["Low"], close=df["Close"], step=0.02, max_step=2, fillna=True) df['psar'] = indicator_psar.psar() # Add Moving Average Convergence Divergence (MACD) indicator df["MACD"] = macd(close=df["Close"], window_slow=26, window_fast=12, fillna=True) # mazas # Add Relative Strength Index (RSI) indicator df["RSI"] = rsi(close=df["Close"], window=14, fillna=True) # mazas return df
def AddIndicators(df): # Add Parabolic Stop and Reverse (Parabolic SAR) indicator indicator_psar = PSARIndicator(high=df["High"], low=df["Low"], close=df["Close"], step=0.02, max_step=2, fillna=True) df['psar'] = indicator_psar.psar() return df