☰
Login
Signup
Home
›
dinezh
›
Discussions
Activity
Discussions
1
Comments
27
Howdy, Stranger!
It looks like you're new here. If you want to get involved, click one of these buttons!
Sign In
Register
dinezh
Best Python function to calculate RSI def calc_RSI(series, period=14): delta = series.diff().dropna() ups = delta * 0 downs = ups.copy() ups[delta > 0] = delta[delta > 0] downs[delta < 0] = -delta[delta < 0] ups[ups.index[period-1]] = np.mean( ups[:period] )
#first
value is sum of avg gains ups = ups.drop(ups.index[:(period-1)]) downs[downs.index[period-1]] = np.mean( downs[:period] )
#first
value is sum of avg losses downs = downs.drop(downs.index[:(period-1)]) rs = ups.ewm(com=period-1,min_periods=0,adjust=False,ignore_na=False).mean() / \ downs.ewm(com=period-1,min_periods=0,adjust=False,ignore_na=False).mean() return 100 - 100 / (1 + rs)
About
Username
dinezh
Joined
June 2020
Visits
38
Last Active
February 22
Roles
Member
Activity
Discussions
1
Comments
27
Discussions
Tick historical data vendor needed
0
points
36
views
Most recent by
Sravanthi_bh
February 24
General
36
1