bukosabino / ta

Technical Analysis Library using Pandas and Numpy
https://technical-analysis-library-in-python.readthedocs.io/en/latest/
MIT License
4.39k stars 940 forks source link

Can you add Stochastic RSI ? #39

Open asimsan opened 5 years ago

asimsan commented 5 years ago

There is already a stochastic oscillator indicator, but can you also add Stochastic RSI indicator ? It would be of great help. I haven't found a single Stochastic RSI indicator, that matches with the one from Trading view.

alik604 commented 4 years ago

There might be a bug

from ta.momentum import rsi
ind_rsi = rsi(data.Close,14)
ind_rsi = ind.replace([np.inf, -np.inf,0], np.nan).fillna(50)

rolling = ind_rsi.rolling(14,0)
ind_stoch_RSI = (ind_rsi - rolling.min())/(rolling.max() - rolling.min())

derivative = np.where(np.diff(np.sign(np.nan_to_num(np.gradient(ind_rsi),=True))))[0] 
# https://stackoverflow.com/a/21171725