OPEN-SOURCE SCRIPT

Combined Triggers Dashboard

98
//version=6
indicator("Combined Triggers Dashboard", overlay=true)

// ======================= INPUTS =======================
// Daily Trigger
shortDEMA_D = input.int(10, "Daily 10 DEMA")
longDEMA_D = input.int(20, "Daily 20 DEMA")
volAvgLen_D = input.int(20, "Daily 20-day Avg Volume")
volMultiplier_D = input.float(3, "Daily Volume Multiplier")
weekDEMAlen_D = input.int(10, "10-Week DEMA Reference for Daily Trigger")

// Weekly Trigger
shortDEMA_W = input.int(10, "Weekly 10 W DEMA")
longDEMA_W = input.int(20, "Weekly 20 W DEMA")
volAvgLen_W = input.int(50, "50-day Avg Volume for Weekly Trigger")
volMultiplier_W = input.float(3, "Weekly Volume Multiplier")

// Original Trigger (example)
shortDEMA_O = input.int(10, "Original 10 DEMA")
longDEMA_O = input.int(20, "Original 20 DEMA")
volAvgLen_O = input.int(20, "Original 20-day Avg Volume")
volMultiplier_O = input.float(3, "Original Volume Multiplier")

// ======================= FUNCTIONS =======================
f_dema(_src, _len) =>
ema1 = ta.ema(_src, _len)
ema2 = ta.ema(ema1, _len)
2 * ema1 - ema2

// ======================= DAILY TRIGGER =======================
dema10D = f_dema(close, shortDEMA_D)
dema20D = f_dema(close, longDEMA_D)
dailyVol = volume
avgVol20 = ta.sma(dailyVol, volAvgLen_D)
volCondition_D = dailyVol > volMultiplier_D * avgVol20
priceCondition_D = close > dema10D
demaCondition_D = dema10D > dema20D

weeklyClose_D = request.security(syminfo.tickerid, "W", close)
dema10W_D = ta.ema(weeklyClose_D, weekDEMAlen_D) * 2 - ta.ema(ta.ema(weeklyClose_D, weekDEMAlen_D), weekDEMAlen_D)

trigger_D = priceCondition_D and demaCondition_D and volCondition_D

plotshape(trigger_D, title="Daily Trigger", style=shape.triangleup, location=location.abovebar,
text="DTRG", textcolor=color.white, color=color.new(#FF4500, 0), size=size.small)
alertcondition(trigger_D, title="Daily DEMA Trigger Alert", message="Daily DEMA trigger detected")

// ======================= WEEKLY TRIGGER =======================
weeklyClose_W = request.security(syminfo.tickerid, "W", close)
dema10W = f_dema(weeklyClose_W, shortDEMA_W)
dema20W = f_dema(weeklyClose_W, longDEMA_W)
dailyVolW = volume
avgVol50 = ta.sma(dailyVolW, volAvgLen_W)
volCondition_W = dailyVolW > volMultiplier_W * avgVol50
priceCondition_W = close > dema20W
demaCondition_W = dema10W > dema20W
trigger_W = priceCondition_W and demaCondition_W and volCondition_W

plotshape(trigger_W, title="Weekly Trigger", style=shape.triangledown, location=location.abovebar,
text="WTRG", textcolor=color.white, color=color.new(#1E90FF, 0), size=size.small)
alertcondition(trigger_W, title="Weekly DEMA Trigger Alert", message="Weekly DEMA trigger detected")

// ======================= ORIGINAL TRIGGER =======================
dema10O = f_dema(close, shortDEMA_O)
dema20O = f_dema(close, longDEMA_O)
dailyVolO = volume
avgVolO = ta.sma(dailyVolO, volAvgLen_O)
volCondition_O = dailyVolO > volMultiplier_O * avgVolO
priceCondition_O = close > dema10O
demaCondition_O = dema10O > dema20O
trigger_Orig = priceCondition_O and demaCondition_O and volCondition_O

plotshape(trigger_Orig, title="Original Trigger", style=shape.labelup, location=location.belowbar,
text="TRG", textcolor=color.white, color=color.new(#32CD32, 0), size=size.small)

// ======================= COMBINED TABLE =======================
var table dash = table.new(position.top_right, 2, 20, border_width=1)

if barstate.islast
// --- DAILY TRIGGER (rows 0-4) ---
table.cell(dash, 0, 0, "Daily Trigger", text_color=color.white, bgcolor=color.new(#555555, 30))
table.cell(dash, 1, 0, trigger_D ? "YES ✅" : "NO ❌", text_color=color.white, bgcolor=trigger_D ? color.new(#FF4500, 0) : color.new(#555555, 50))
table.cell(dash, 0, 1, "CMP > 10D DEMA", text_color=color.white, bgcolor=color.new(#555555, 30))
table.cell(dash, 1, 1, str.tostring(close, format.price), text_color=color.white, bgcolor=priceCondition_D ? color.new(#32CD32, 0) : color.new(#AAAAAA, 50))
table.cell(dash, 0, 2, "10D > 20D DEMA", text_color=color.white, bgcolor=color.new(#555555, 30))
table.cell(dash, 1, 2, str.tostring(dema10D, format.price) + " > " + str.tostring(dema20D, format.price), text_color=color.white, bgcolor=demaCondition_D ? color.new(#FFFF00, 0) : color.new(#AAAAAA, 50))
table.cell(dash, 0, 3, "Daily Vol > 3x20D Avg", text_color=color.white, bgcolor=color.new(#555555, 30))
table.cell(dash, 1, 3, str.tostring(dailyVol, format.volume) + " / " + str.tostring(avgVol20, format.volume), text_color=color.white, bgcolor=volCondition_D ? color.new(#FF00FF, 0) : color.new(#AAAAAA, 50))
table.cell(dash, 0, 4, "10W DEMA Ref", text_color=color.white, bgcolor=color.new(#555555, 30))
table.cell(dash, 1, 4, str.tostring(dema10W_D, format.price), text_color=color.white, bgcolor=color.new(#00FFFF, 0))

// --- WEEKLY TRIGGER (rows 5-9) ---
table.cell(dash, 0, 5, "Weekly Trigger", text_color=color.white, bgcolor=color.new(#555555, 30))
table.cell(dash, 1, 5, trigger_W ? "YES ✅" : "NO ❌", text_color=color.white, bgcolor=trigger_W ? color.new(#1E90FF, 0) : color.new(#555555, 50))
table.cell(dash, 0, 6, "CMP > 20W DEMA", text_color=color.white, bgcolor=color.new(#555555, 30))
table.cell(dash, 1, 6, str.tostring(close, format.price), text_color=color.white, bgcolor=priceCondition_W ? color.new(#32CD32, 0) : color.new(#AAAAAA, 50))
table.cell(dash, 0, 7, "10W > 20W DEMA", text_color=color.white, bgcolor=color.new(#555555, 30))
table.cell(dash, 1, 7, str.tostring(dema10W, format.price) + " > " + str.tostring(dema20W, format.price), text_color=color.white, bgcolor=demaCondition_W ? color.new(#FFFF00, 0) : color.new(#AAAAAA, 50))
table.cell(dash, 0, 8, "Daily Vol > 3x50D Avg", text_color=color.white, bgcolor=color.new(#555555, 30))
table.cell(dash, 1, 8, str.tostring(dailyVolW, format.volume) + " / " + str.tostring(avgVol50, format.volume), text_color=color.white, bgcolor=volCondition_W ? color.new(#FF00FF, 0) : color.new(#AAAAAA, 50))

// --- ORIGINAL TRIGGER (rows 10-14) ---
table.cell(dash, 0, 10, "Original Trigger", text_color=color.white, bgcolor=color.new(#555555, 30))
table.cell(dash, 1, 10, trigger_Orig ? "YES ✅" : "NO ❌", text_color=color.white, bgcolor=trigger_Orig ? color.new(#32CD32, 0) : color.new(#555555, 50))
table.cell(dash, 0, 11, "CMP > 10D DEMA", text_color=color.white, bgcolor=color.new(#555555, 30))
table.cell(dash, 1, 11, str.tostring(close, format.price), text_color=color.white, bgcolor=priceCondition_O ? color.new(#32CD32, 0) : color.new(#AAAAAA, 50))
table.cell(dash, 0, 12, "10D > 20D DEMA", text_color=color.white, bgcolor=color.new(#555555, 30))
table.cell(dash, 1, 12, str.tostring(dema10O, format.price) + " > " + str.tostring(dema20O, format.price), text_color=color.white, bgcolor=demaCondition_O ? color.new(#FFFF00, 0) : color.new(#AAAAAA, 50))
table.cell(dash, 0, 13, "Daily Vol > 3x20D Avg", text_color=color.white, bgcolor=color.new(#555555, 30))
table.cell(dash, 1, 13, str.tostring(dailyVolO, format.volume) + " / " + str.tostring(avgVolO, format.volume), text_color=color.white, bgcolor=volCondition_O ? color.new(#FF00FF, 0) : color.new(#AAAAAA, 50))

Pernyataan Penyangkalan

Informasi dan publikasi tidak dimaksudkan untuk menjadi, dan bukan merupakan saran keuangan, investasi, perdagangan, atau rekomendasi lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Persyaratan Penggunaan.