-
Notifications
You must be signed in to change notification settings - Fork 4
/
indicator_old.py
executable file
·85 lines (54 loc) · 2.11 KB
/
indicator_old.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
from ejtrader import indicators as TA
from candlestick import candlestick as cd
def Indicators(df):
df = df.rename(columns = {'min':'low', 'max':'high'}) # raname DF columns
# Keltner Channels
keltner = TA.KC(df)
df['KC_UPPER'] = keltner['KC_UPPER']
df['KC_LOWER'] = keltner['KC_LOWER']
bolinger = TA.BBANDS(df)
df['BB_UPPER'] = bolinger['BB_UPPER']
df['BB_MIDDLE'] = bolinger['BB_MIDDLE']
df['BB_LOWER'] = bolinger['BB_LOWER']
# # MACD
# MACD = TA.MACD(df)
# df['MACD'] = MACD['MACD']
# df['SIGNAL'] = MACD['SIGNAL']
# df['BearishHarami'] = cd.bearish_harami(df)
# df['BullishHarami'] = cd.bullish_harami(df)
# df['DarkCloudCover'] = cd.dark_cloud_cover(df)
# # df['MorningStarDoji'] = cd.morning_star_doji(df) # bug
# # df['ShootingStar'] = cd.shooting_star(df) # bug
# df['DragonflyDoji'] = cd.dragonfly_doji(df)
# df['BearishEngulfing'] = cd.bearish_engulfing(df)
# df['BullishEngulfing'] = cd.bullish_engulfing(df)
# df['HangingMan'] = cd.hanging_man(df)
# df['MorningStar'] = cd.morning_star(df)
# df['MorningStarDoji'] = cd.morning_star_doji(df)
# df['PiercingPattern'] = cd.piercing_pattern(df)
# df['RainDrop'] = cd.rain_drop(df)
# df['RainDropDoji'] = cd.rain_drop_doji(df)
# df['GravestoneDoji'] = cd.gravestone_doji(df)
# df['ShootingStar'] = cd.shooting_star(df)
# df['Hammer'] = cd.hammer(df)
# df['doji'] = cd.doji(df)
# df['Star'] = cd.star(df)
#simple moving avarage
df['SMA_20'] = TA.SSMA(df,20)
df['SMA_50'] = TA.SSMA(df,50)
# exponential moving average
df['EMA_20'] = TA.EMA(df,20, adjust=False)
df['EMA_50'] = TA.EMA(df,50, adjust=False)
#Stochastic Oscillator
df['%K'] = TA.STOCH(df, 14)
df['%D'] = TA.STOCHD(df, 14)
#Relative Strenght Index 'RSI'
df['rsi'] = TA.RSI(df, 14)
df['cci'] = TA.CCI(df,period=14)
ROC = TA.ROC(df,1)
df['close'] = ROC
# df['VPT'] = TA.VPT(df)
# df['VWAP'] = TA.VWAP(df)
# df = df.rename(columns = {'low':'min', 'high':'max'})
# df = df.drop(columns = {'volume'})
return df