Python Stochastic RSI (same as TradingView)

Feb 24, 2021
import numpy as npimport talib as taimport tulipy as tirsi = ta.RSI(data['Close'], timeperiod=14)rsinp = rsi.valuesrsinp = rsinp[np.logical_not(np.isnan(rsinp))]fastk, fastd = ti.stoch(rsinp, rsinp, rsinp, 14, 3, 3)data['fastk'] = np.concatenate([np.empty(31) * np.nan, fastk])data['fastd'] = np.concatenate([np.empty(31) * np.nan, fastd])

NOTE: ta.STOCHRSI issue.

The following produce quite similar result with minor differences.

rsi = ta.RSI(data['Close'])data['fastk'], data['fastd'] = ta.STOCH(rsi, rsi, rsi)
rsi = ta.RSI(data['Close'])rsinp = rsi.valuesrsinp = rsinp[np.logical_not(np.isnan(rsinp))]data['fastk'], data['fastd'] = ta.STOCH(rsinp , rsinp, rsinp)

❤️ Is this article helpful?

Buy me a coffee ☕ or support my work via PayPal to keep this space 🖖 and ad-free.

Do send some 💖 to @d_luaz or share this article.

✨ By Desmond Lua

A dream boy who enjoys making apps, travelling and making youtube videos. Follow me on @d_luaz

👶 Apps I built

Travelopy - discover travel places in Malaysia, Singapore, Taiwan, Japan.