OPEN-SOURCE SCRIPT
XAUUSD Pro Strategy

//version=5
indicator("XAUUSD RR Buy Sell Indicator", overlay=true, max_labels_count=500, max_boxes_count=100)
// ===== INPUT =====
rr = input.float(2.0, "Risk Reward", step=0.1)
sl_pips = input.int(300, "Stop Loss (points)")
show_boxes = input.bool(true, "Show Entry SL TP Box")
// ===== EMA =====
ema9 = ta.ema(close, 9)
ema50 = ta.ema(close, 50)
ema200 = ta.ema(close, 200)
plot(ema9, color=color.yellow)
plot(ema50, color=color.blue)
plot(ema200,color=color.red)
// ===== TREND =====
bull = ema50 > ema200
bear = ema50 < ema200
// ===== ENTRY CONDITIONS =====
buyCond = bull and close > ema9 and close[1] < ema9
sellCond = bear and close < ema9 and close[1] > ema9
// ===== PRICE CALC =====
buyEntry = close
buySL = buyEntry - sl_pips * syminfo.mintick
buyTP = buyEntry + (buyEntry - buySL) * rr
sellEntry = close
sellSL = sellEntry + sl_pips * syminfo.mintick
sellTP = sellEntry - (sellSL - sellEntry) * rr
// ===== DRAW =====
if buyCond
label.new(bar_index, low, "BUY", style=label.style_label_up, color=color.green, textcolor=color.white)
if show_boxes
box.new(bar_index, buyEntry, bar_index + 5, buySL, bgcolor=color.new(color.red,80))
box.new(bar_index, buyTP, bar_index + 5, buyEntry, bgcolor=color.new(color.green,80))
if sellCond
label.new(bar_index, high, "SELL", style=label.style_label_down, color=color.red, textcolor=color.white)
if show_boxes
box.new(bar_index, sellSL, bar_index + 5, sellEntry, bgcolor=color.new(color.red,80))
box.new(bar_index, sellEntry, bar_index + 5, sellTP, bgcolor=color.new(color.green,80))
indicator("XAUUSD RR Buy Sell Indicator", overlay=true, max_labels_count=500, max_boxes_count=100)
// ===== INPUT =====
rr = input.float(2.0, "Risk Reward", step=0.1)
sl_pips = input.int(300, "Stop Loss (points)")
show_boxes = input.bool(true, "Show Entry SL TP Box")
// ===== EMA =====
ema9 = ta.ema(close, 9)
ema50 = ta.ema(close, 50)
ema200 = ta.ema(close, 200)
plot(ema9, color=color.yellow)
plot(ema50, color=color.blue)
plot(ema200,color=color.red)
// ===== TREND =====
bull = ema50 > ema200
bear = ema50 < ema200
// ===== ENTRY CONDITIONS =====
buyCond = bull and close > ema9 and close[1] < ema9
sellCond = bear and close < ema9 and close[1] > ema9
// ===== PRICE CALC =====
buyEntry = close
buySL = buyEntry - sl_pips * syminfo.mintick
buyTP = buyEntry + (buyEntry - buySL) * rr
sellEntry = close
sellSL = sellEntry + sl_pips * syminfo.mintick
sellTP = sellEntry - (sellSL - sellEntry) * rr
// ===== DRAW =====
if buyCond
label.new(bar_index, low, "BUY", style=label.style_label_up, color=color.green, textcolor=color.white)
if show_boxes
box.new(bar_index, buyEntry, bar_index + 5, buySL, bgcolor=color.new(color.red,80))
box.new(bar_index, buyTP, bar_index + 5, buyEntry, bgcolor=color.new(color.green,80))
if sellCond
label.new(bar_index, high, "SELL", style=label.style_label_down, color=color.red, textcolor=color.white)
if show_boxes
box.new(bar_index, sellSL, bar_index + 5, sellEntry, bgcolor=color.new(color.red,80))
box.new(bar_index, sellEntry, bar_index + 5, sellTP, bgcolor=color.new(color.green,80))
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.