OPEN-SOURCE SCRIPT

XAUUSD M15 Supply & Demand + Entry/SL/TP + Alerts

189
//version=5
indicator("XAUUSD M15 Supply & Demand + Entry/SL/TP + Alerts", overlay=true)

// ======================
// 🔹 Demand Zones
// ======================
demand1_top = 3682
demand1_bottom = 3678
box.new(left=bar_index-50, top=demand1_top, right=bar_index+50, bottom=demand1_bottom,
bgcolor=color.new(color.green, 85), border_color=color.green)

demand2_top = 3665
demand2_bottom = 3660
box.new(left=bar_index-50, top=demand2_top, right=bar_index+50, bottom=demand2_bottom,
bgcolor=color.new(color.green, 85), border_color=color.green)

// ======================
// 🔺 Supply Zones
// ======================
supply1_top = 3695
supply1_bottom = 3690
box.new(left=bar_index-50, top=supply1_top, right=bar_index+50, bottom=supply1_bottom,
bgcolor=color.new(color.red, 85), border_color=color.red)

supply2_top = 3712
supply2_bottom = 3708
box.new(left=bar_index-50, top=supply2_top, right=bar_index+50, bottom=supply2_bottom,
bgcolor=color.new(color.red, 85), border_color=color.red)

// ======================
// 📍 Levels
// ======================
entry_price = 3680
sl_price = 3661
tp1_price = 3692
tp2_price = 3710

// ======================
// 🏷️ Labels
// ======================
label.new(bar_index, entry_price, text="ENTRY BUY\n3680 ±2",
style=label.style_label_up, color=color.green, textcolor=color.white)
label.new(bar_index, sl_price, text="STOP LOSS\n3661",
style=label.style_label_down, color=color.red, textcolor=color.white)
label.new(bar_index, tp1_price, text="TP1\n3692-3695",
style=label.style_label_down, color=color.blue, textcolor=color.white)
label.new(bar_index, tp2_price, text="TP2\n3708-3712",
style=label.style_label_down, color=color.blue, textcolor=color.white)

// ======================
// 🔔 Alerts
// ======================
// Entry Zone
inEntry = (low <= demand1_top and high >= demand1_bottom)
alertcondition(inEntry, title="Entry Zone Hit", message="XAUUSD masuk ENTRY BUY zone (3680±2)")

// Stop Loss
hitSL = (low <= sl_price)
alertcondition(hitSL, title="Stop Loss Hit", message="XAUUSD STOP LOSS kena di 3661 ❌")

// Take Profit 1
hitTP1 = (high >= tp1_price and high <= supply1_top)
alertcondition(hitTP1, title="TP1 Hit", message="XAUUSD TP1 tercapai ✅ (3692-3695)")

// Take Profit 2
hitTP2 = (high >= tp2_price and high <= supply2_top)
alertcondition(hitTP2, title="TP2 Hit", message="XAUUSD TP2 tercapai 🎯 (3708-3712)")

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.