☰
Login
Signup
Home
›
dinezh
›
Discussions
Activity
Discussions
1
Comments
28
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
41
Last Active
March 1
Roles
Member
Activity
Discussions
1
Comments
28
Discussions
Tick historical data vendor needed
0
points
75
views
Most recent by
dinezh
February 28
General
75
2