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)")
开源脚本
本着TradingView的真正精神,此脚本的创建者将其开源,以便交易者可以查看和验证其功能。向作者致敬!虽然您可以免费使用它,但请记住,重新发布代码必须遵守我们的网站规则。
免责声明
这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。
开源脚本
本着TradingView的真正精神,此脚本的创建者将其开源,以便交易者可以查看和验证其功能。向作者致敬!虽然您可以免费使用它,但请记住,重新发布代码必须遵守我们的网站规则。
免责声明
这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。