OPEN-SOURCE SCRIPT
Dual TF Bearish Divergence (Working)

//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")
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")
開源腳本
秉持TradingView一貫精神,這個腳本的創作者將其設為開源,以便交易者檢視並驗證其功能。向作者致敬!您可以免費使用此腳本,但請注意,重新發佈代碼需遵守我們的社群規範。
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。
開源腳本
秉持TradingView一貫精神,這個腳本的創作者將其設為開源,以便交易者檢視並驗證其功能。向作者致敬!您可以免費使用此腳本,但請注意,重新發佈代碼需遵守我們的社群規範。
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。