This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# I was not able to retrieve same results as Trading View with talib STOCHRSI function... | |
# I may misuse talib params but I found it easier to rewrite the computation, following Trading View doc | |
# https://www.tradingview.com/support/solutions/43000502333-stochastic-rsi-stoch-rsi/ | |
# watchout on your params ;) | |
rsi = ta.RSI(dataframe) | |
stochrsi = 100 * (rsi - rsi.rolling(14).min()) / (rsi.rolling(14).max() - rsi.rolling(14).min()) | |
dataframe['stochrsi_fastk'] = stochrsi.rolling(3).mean() | |
dataframe['stochrsi_fastd'] = dataframe['stochrsi_fastk'].rolling(3).mean() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# I was not able to retrieve same results as Trading View with talib STOCH function... | |
# I may misuse talib params but I found it easier to rewrite the computation, following Trading View doc | |
# https://www.tradingview.com/support/solutions/43000502332-stochastic-stoch/ | |
# watchout on your params ;) | |
stoch = 100 * (dataframe['close'] - dataframe['low'].rolling(14).min()) / (dataframe['high'].rolling(14).max() - dataframe['low'].rolling(14).min()) | |
dataframe['stoch_slowk'] = ta.SMA(stoch, 5) | |
dataframe['stoch_slowd'] = ta.SMA(dataframe['stoch_slowk'], 3) |