OPEN-SOURCE SCRIPT

RSI Reversal Alerts

162
//version=5
indicator("RSI Reversal Alerts", overlay=false)

// 🛠️ กำหนดค่าตัวแปร
rsiLength = input(14, title="RSI Length") // ตั้งค่า Period ของ RSI
rsiOverbought = input(52, title="RSI Overbought Level") // ระดับ RSI ขาลง
rsiOversold = input(48, title="RSI Oversold Level") // ระดับ RSI ขาขึ้น

// 📈 คำนวณค่า RSI
rsiValue = ta.rsi(close, rsiLength)

// 🔍 ตรวจจับสัญญาณกลับตัว
bullishSignal = ta.crossover(rsiValue, rsiOverbought) and ta.lowest(rsiValue, 5) < rsiOversold
bearishSignal = ta.crossunder(rsiValue, rsiOversold) and ta.highest(rsiValue, 5) > rsiOverbought

// 🔔 ตั้งค่า Alert Condition
alertcondition(bullishSignal, title="Bullish RSI Reversal", message="RSI crossed above 52 after being below 48!")
alertcondition(bearishSignal, title="Bearish RSI Reversal", message="RSI crossed below 48 after being above 52!")

// 🎯 แสดงสัญญาณบนกราฟ
plot(rsiValue, title="RSI", color=color.blue)
hline(rsiOverbought, "Overbought Level", color=color.red)
hline(rsiOversold, "Oversold Level", color=color.green)

// 🔵 เพิ่มสัญลักษณ์บนกราฟ
plotshape(series=bullishSignal, location=location.bottom, color=color.green, style=shape.labelup, title="Bullish Signal")
plotshape(series=bearishSignal, location=location.top, color=color.red, style=shape.labeldown, title="Bearish Signal")

Wyłączenie odpowiedzialności

Informacje i publikacje przygotowane przez TradingView lub jego użytkowników, prezentowane na tej stronie, nie stanowią rekomendacji ani porad handlowych, inwestycyjnych i finansowych i nie powinny być w ten sposób traktowane ani wykorzystywane. Więcej informacji na ten temat znajdziesz w naszym Regulaminie.