I was wondering is there any Python library that covers RSI-Divergence
(difference between a fast and a slow RSI
) or any guidence about how can I implement its algorithm in Python.
Already asked question: Programmatically detect RSI divergence. One of the answer suggests quantconnect forum for the Python version but it does not cover anything.
I was not able to find its mathematical formula but I was able to find the RSI-Divergence in pine-script, as below, but I was not able to convert it into Python since its not possible to debug pine-script
using tradingview.
study(title="RSI Divergence", shorttitle="RSI Divergence") src_fast = close, len_fast = input(5, minval=1, title="Length Fast RSI") src_slow = close, len_slow = input(14,minval=1, title="Length Slow RSI") up_fast = rma(max(change(src_fast), 0), len_fast) down_fast = rma(-min(change(src_fast), 0), len_fast) rsi_fast = down_fast == 0 ? 100 : up_fast == 0 ? 0 : 100 - (100 / (1 + up_fast / down_fast)) up_slow = rma(max(change(src_slow), 0), len_slow) down_slow = rma(-min(change(src_slow), 0), len_slow) rsi_slow = down_slow == 0 ? 100 : up_slow == 0 ? 0 : 100 - (100 / (1 + up_slow / down_slow)) divergence = rsi_fast - rsi_slow plotdiv = plot(divergence, color = divergence > 0 ? lime:red, linewidth = 2) band = hline(0)
pandas OHLC Dataframe
dataset? or is there any example dataset that I can use (ex:BTC:USDT
)? – Dolly