OPEN-SOURCE SCRIPT

Dual TF Bearish Divergence (Working)

27
//version=6
indicator("Dual TF Bearish Divergence (Working)", overlay=true)

// ----------------- SIMPLE BEARISH DIVERGENCE FUNCTION -------------------
bearDiv(src, rsiLen, lookbackMin, lookbackMax) =>
r = ta.rsi(src, rsiLen)
ph = ta.pivothigh(src, lookbackMin, lookbackMin)
ph_rsi = ta.pivothigh(r, lookbackMin, lookbackMin)
ph2 = ph[lookbackMin]
ph2_rsi = ph_rsi[lookbackMin]
priceHH = not na(ph) and not na(ph2) and ph > ph2
rsiLH = not na(ph_rsi) and not na(ph2_rsi) and ph_rsi < ph2_rsi
barsOk = lookbackMin >= lookbackMin and lookbackMin <= lookbackMax
priceHH and rsiLH and barsOk

// ----------------- TF CALLS -------------------
b60 = request.security(syminfo.tickerid, "60", bearDiv(close, 14, 10, 15))
b240 = request.security(syminfo.tickerid, "240", bearDiv(close, 14, 10, 15))

dual = b60 and b240

// ----------------- PLOT -------------------
plotshape(dual, title="Dual Bear Div", style=shape.labeldown,
color=color.red, size=size.small, text="🔻BearDiv")

// ----------------- ALERT -------------------
alertcondition(dual, "Dual Bearish Div 60+240",
"Bearish Divergence on both 60m & 240m")

Pernyataan Penyangkalan

Informasi dan publikasi ini tidak dimaksudkan, dan bukan merupakan, saran atau rekomendasi keuangan, investasi, trading, atau jenis lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Ketentuan Penggunaan.