PROTECTED SOURCE SCRIPT

RSI Levels on Candle Chart (40/50/60)

16
//version=5
indicator("RSI Levels on Candle Chart (40/50/60)", overlay=true)

// === RSI Calculation ===
rsi = ta.rsi(close, 21)

// === Define RSI Levels to Draw ===
rsi_40 = 40
rsi_50 = 50
rsi_60 = 60

// === Define RSI min/max range for scaling to price
rsi_min = 30
rsi_max = 70

// === Get visible price range for mapping
price_min = ta.lowest(low, 100)
price_max = ta.highest(high, 100)

// === Function to map RSI to price chart Y-axis
rsiToPrice(rsiLevel) =>
price_min + (rsiLevel - rsi_min) / (rsi_max - rsi_min) * (price_max - price_min)

// === Map RSI levels to price scale
price_rsi_40 = rsiToPrice(rsi_40)
price_rsi_50 = rsiToPrice(rsi_50)
price_rsi_60 = rsiToPrice(rsi_60)

// === Plot horizontal lines at RSI levels
plot(price_rsi_40, title="RSI 40 (Red)", color=color.red, linewidth=2)
plot(price_rsi_50, title="RSI 50 (Blue)", color=color.blue, linewidth=2)
plot(price_rsi_60, title="RSI 60 (Green)", color=color.green, linewidth=2)

Penafian

Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.