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)

Wyłączenie odpowiedzialności

Informacje i publikacje przygotowane przez TradingView lub jego użytkowników, prezentowane na tej stronie, nie stanowią rekomendacji ani porad handlowych, inwestycyjnych i finansowych i nie powinny być w ten sposób traktowane ani wykorzystywane. Więcej informacji na ten temat znajdziesz w naszym Regulaminie.