OPEN-SOURCE SCRIPT

RSI Reversal Alerts

138
//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")

Clause de non-responsabilité

Les informations et les publications ne sont pas destinées à être, et ne constituent pas, des conseils ou des recommandations en matière de finance, d'investissement, de trading ou d'autres types de conseils fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.