OPEN-SOURCE SCRIPT
XAUUSD M15 Supply & Demand + Entry/SL/TP + Alerts

//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)")
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)")
Script de código abierto
Siguiendo fielmente el espíritu de TradingView, el creador de este script lo ha publicado en código abierto, permitiendo que otros traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Puede utilizarlo de forma gratuita, pero tenga en cuenta que la publicación de este código está sujeta a nuestras Normas internas.
Exención de responsabilidad
La información y las publicaciones que ofrecemos, no implican ni constituyen un asesoramiento financiero, ni de inversión, trading o cualquier otro tipo de consejo o recomendación emitida o respaldada por TradingView. Puede obtener información adicional en las Condiciones de uso.
Script de código abierto
Siguiendo fielmente el espíritu de TradingView, el creador de este script lo ha publicado en código abierto, permitiendo que otros traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Puede utilizarlo de forma gratuita, pero tenga en cuenta que la publicación de este código está sujeta a nuestras Normas internas.
Exención de responsabilidad
La información y las publicaciones que ofrecemos, no implican ni constituyen un asesoramiento financiero, ni de inversión, trading o cualquier otro tipo de consejo o recomendación emitida o respaldada por TradingView. Puede obtener información adicional en las Condiciones de uso.