Esempio n. 1
0
# FOR TOMORROW'S TRADING SESSION
"""
import pandas as pd
import Indicators
import matplotlib.pyplot as plt
import numpy as np
import matplotlib.finance as fnc

fName = '/home/ale/Documenti/Trading Studies/Data/FIB_Data_New.xlsx'
data = pd.read_excel(fName, Sheetname='1M')
#%%

df = pd.DataFrame(data['Close'])

#Put Indicators
Ind = Indicators.Indicator(df['Close'])

df['Trend_Strength'] = Ind.Trend_Strength(50)
df['RSI'] = Ind.RSI(20)
df['RSI_MA2'] = df['RSI'].rolling(10).mean()
df['RSI_MA1'] = df['RSI'].rolling(5).mean()
df['EMA-10'] = Ind.EMA(10)
df['EMA-20'] = Ind.EMA(20)
df['MACD'] = Ind.MACD_Delta(50, 20, 10)
df['MACD_MA2'] = df['MACD'].rolling(10).mean()
df['MACD_MA1'] = df['MACD'].rolling(5).mean()

#%%

start = 6500
stop = 6700
Esempio n. 2
0
df_temp = pd.DataFrame(data['Date'])
df_temp['time'] = data['Time']
df_temp['change'] = data['change']
df_temp['volume'] = data['Vol']
df_temp['close'] = data['Close']
df_temp['open'] = data['Open']

#Create Lags onwards and backwards
for i in range(1, max_lag + 1):

    #Onward lags for output
    df_temp['change-' + str(i) + '-out'] = df_temp['change'].shift(-i)

#Put Indicators
Ind = Indicators.Indicator(df_temp['close'])

df_temp['Trend_Strength'] = Ind.Trend_Strength(50)
df_temp['RSI'] = Ind.RSI(20)
df_temp['RSI_MA2'] = df_temp['RSI'].rolling(10).mean()
df_temp['RSI_MA1'] = df_temp['RSI'].rolling(5).mean()
df_temp['EMA-10'] = Ind.EMA(10)
df_temp['EMA-20'] = Ind.EMA(20)
df_temp['MACD'] = Ind.MACD_Delta(26, 12, 9)
df_temp['MACD_MA2'] = df_temp['MACD'].rolling(10).mean()
df_temp['MACD_MA1'] = df_temp['MACD'].rolling(5).mean()

#Eliminate first max_lag elements of the day
i = 1

while i < df_temp.shape[0]: