OPEN-SOURCE SCRIPT

Divergence Finder

129
//version=5
indicator("Divergence Finder", overlay=true)

// Parameter
length = input(14, title="RSI Length")
source = close
rsi = ta.rsi(source, length)

// Mencari Titik High dan Low
ph = ta.pivothigh(high, 5, 5)
pl = ta.pivotlow(low, 5, 5)
rsi_ph = ta.pivothigh(rsi, 5, 5)
rsi_pl = ta.pivotlow(rsi, 5, 5)

// Bearish Divergence
bearishDivergence = na(ph[5]) == false and na(rsi_ph[5]) == false and ph[5] > ph and rsi_ph[5] < rsi_ph

// Bullish Divergence
bullishDivergence = na(pl[5]) == false and na(rsi_pl[5]) == false and pl[5] < pl and rsi_pl[5] > rsi_pl

// Plot Divergence
plotshape(bearishDivergence, location=location.abovebar, color=color.red, style=shape.labeldown, title="Bearish Divergence")
plotshape(bullishDivergence, location=location.belowbar, color=color.green, style=shape.labelup, title="Bullish Divergence")

// Menampilkan RSI pada Subwindow
hline(70, "Overbought", color=color.red)
hline(30, "Oversold", color=color.green)
plot(rsi, title="RSI", color=color.blue)

Clause de non-responsabilité

Les informations et les publications ne sont pas destinées à être, et ne constituent pas, des conseils ou des recommandations en matière de finance, d'investissement, de trading ou d'autres types de conseils fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.