OPEN-SOURCE SCRIPT

Z-Score of RSI

84
//version=5
indicator("Z-Score of RSI", overlay=false)

// Tham số
rsi_length = input.int(14, "RSI Length")
z_length = input.int(60, "Z-Score Period")

// Tính RSI
rsi = ta.rsi(close, rsi_length)

// Tính Z-Score
mean_rsi = ta.sma(rsi, z_length)
std_rsi = ta.stdev(rsi, z_length)
z_rsi = (rsi - mean_rsi) / std_rsi

// Vẽ biểu đồ
plot(z_rsi, color=color.new(color.aqua, 0), linewidth=2, title="Z-Score(RSI)")
hline(0, "Mean", color=color.gray)
hline(2, "Overbought (+2σ)", color=color.red)
hline(-2, "Oversold (-2σ)", color=color.lime)

// Cảnh báo (tuỳ chọn)
bgcolor(z_rsi < -2 ? color.new(color.lime, 85) : na)
bgcolor(z_rsi > 2 ? color.new(color.red, 85) : na)

Exención de responsabilidad

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.