def process_data(data): data['BB_5'] = ta.bollinger_mavg( data['CLOSE'], 5) #bollinger_moving average 5 trading periods data['BB_10'] = ta.bollinger_mavg( data['CLOSE'], 10) #bollinger_moving average 10 trading periods data['BB_20'] = ta.bollinger_mavg( data['CLOSE'], 20) # bollinger_moving average 20 periods data['ADX'] = ta.adx(data['HIGH'], data['LOW'], data['CLOSE'], 14) #Average Directional Index data['ATR'] = ta.average_true_range(data['HIGH'], data['LOW'], data['CLOSE'], 14) #Average True Range data['CCI'] = ta.cci(data['HIGH'], data['LOW'], data['CLOSE'], 14) #Commodity Channel Index data['DCH'] = ta.donchian_channel_hband( data['CLOSE']) #Donchian Channel High Band data['DCL'] = ta.donchian_channel_lband( data['CLOSE']) #Donchian Channel Low Band data['DPO'] = ta.dpo(data['CLOSE']) #Detrend Price Oscilator data['EMAf'] = ta.ema_fast( data['CLOSE']) #Expornential Moving Average fast data['EMAs'] = ta.ema_slow( data['CLOSE']) #Expornential Moving Average slow data['FI'] = ta.force_index( data['CLOSE'], data['VOLUME']) # Force Index(reveals the value of a trend) data['ICHa'] = ta.ichimoku_a(data['HIGH'], data['LOW']) #Ichimoku A data['ICHb'] = ta.ichimoku_b(data['HIGH'], data['LOW']) #Ichimoku B data['KC'] = ta.keltner_channel_central( data['HIGH'], data['LOW'], data['CLOSE']) #Keltner channel(KC) Central data['KST'] = ta.kst( data['CLOSE'] ) #KST Oscillator (KST) identify major stock market cycle junctures data['MACD'] = ta.macd( data['CLOSE']) # Moving Average convergence divergence data['OBV'] = ta.on_balance_volume_mean( data['CLOSE'], data['VOLUME']) # on_balance_volume_mean data['RSI'] = ta.rsi(data['CLOSE']) # Relative Strength Index (RSI) data['TRIX'] = ta.trix( data['CLOSE'] ) #Shows the percent rate of change of a triple exponentially smoothed moving average data['TSI'] = ta.tsi(data['CLOSE']) #True strength index (TSI) data['ROC1'] = (data['CLOSE'] - data['OPEN']) / data['OPEN'] data['RET'] = data['CLOSE'].pct_change() data['y'] = np.where(data['OPEN'] <= data['CLOSE'], 1, -1) data = data.dropna() return data
ta_df['Aroon_down'] ) ta_df['ATR'] = ta.average_true_range( df["High"], df["Low"], df["Close"]) ta_df['BBH'] = ta.bollinger_hband(df["Close"]) ta_df['BBL'] = ta.bollinger_lband(df["Close"]) ta_df['BBM'] = ta.bollinger_mavg(df["Close"]) ta_df['BBHI'] = ta.bollinger_hband_indicator( df["Close"]) ta_df['BBLI'] = ta.bollinger_lband_indicator( df["Close"]) ta_df['KCC'] = ta.keltner_channel_central( df["High"], df["Low"], df["Close"]) ta_df['KCH'] = ta.keltner_channel_hband( df["High"], df["Low"], df["Close"]) ta_df['KCL'] = ta.keltner_channel_lband( df["High"], df["Low"], df["Close"]) ta_df['KCHI'] = ta.keltner_channel_hband_indicator(df["High"], df["Low"], df["Close"]) ta_df['KCLI'] = ta.keltner_channel_lband_indicator(df["High"], df["Low"], df["Close"])