OPEN-SOURCE SCRIPT

XAUUSD Reversal Indicator

173
//version=5
indicator("XAUUSD Reversal Indicator", overlay=true)

// Moving Averages
ma50 = ta.sma(close, 50)
ma100 = ta.sma(close, 100)
ma200 = ta.sma(close, 200)

// Support & Resistance (based on recent highs and lows)
lengthSR = 20
support = ta.lowest(low, lengthSR)
resistance = ta.highest(high, lengthSR)

// Volume-based Confirmation
volThreshold = ta.sma(volume, 20)
highVolume = volume > volThreshold

// Reversal Conditions
bullishReversal = ta.crossover(close, support) and close > ma50 and close > ma100 and close > ma200 and highVolume
bearishReversal = ta.crossunder(close, resistance) and close < ma50 and close < ma100 and close < ma200 and highVolume

// Highlight Reversal Zones
bgcolor(bullishReversal ? color.green : bearishReversal ? color.red : na, transp=80)

// Plot Support & Resistance Levels
p1 = plot(support, title="Support", color=color.blue, linewidth=2, style=plot.style_dotted)
p2 = plot(resistance, title="Resistance", color=color.orange, linewidth=2, style=plot.style_dotted)

// Alerts
alertcondition(bullishReversal, title="Bullish Reversal Alert", message="Bullish Reversal Detected on XAUUSD")
alertcondition(bearishReversal, title="Bearish Reversal Alert", message="Bearish Reversal Detected on XAUUSD")

// Labels for Reversals
label_offset = 20
if bullishReversal
label.new(bar_index, low - label_offset, "Bullish", color=color.green, textcolor=color.white, size=size.small, style=label.style_label_up)

if bearishReversal
label.new(bar_index, high + label_offset, "Bearish", color=color.red, textcolor=color.white, size=size.small, style=label.style_label_down)

إخلاء المسؤولية

لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.