It looks like you're new here. If you want to get involved, click one of these buttons!
Node JS client
.Net API client
.Net / VBA / Excel (3rd party)
Algorithms and Strategies
Mobile and Desktop apps
Market data (WebSockets)
In this Discussion
How can i calculate RSI.
I have taken live data subscription from Zerodha now i want same value of RSI as we get on zerodha kite chart.
Plz helps me !!
You need to generate candles at your end and then do the calculations.
You can get started from
here i attach a function fro calculating rsi. If you want to create your strategy using RSI than contact me i will provide testing with backtesting.
def rsi(df, n):
"function to calculate RSI"
delta = df["close"].diff().dropna()
u = delta * 0
d = u.copy()
u[delta > 0] = delta[delta > 0]
d[delta < 0] = -delta[delta < 0]
u[u.index[n-1]] = np.mean( u[:n]) # first value is average of gains
u = u.drop(u.index[:(n-1)])
d[d.index[n-1]] = np.mean( d[:n]) # first value is average of losses
d = d.drop(d.index[:(n-1)])
rs = u.ewm(com=n,min_periods=n).mean()/d.ewm(com=n,min_periods=n).mean()
df['RSI'] = 100 - 100 / (1+rs)