本页源码来自 TradingView 公开发布的开源脚本,版权归原作者所有, 请遵循其原始许可(Pine 脚本常见 CC BY-NC-SA / MPL-2.0 / MIT)。 本项目仅用于研究检索与许可范围内的移植。
//@version=6
// QRSI 1.2 - fixed-source RSI with lower-zone shading.
indicator("QRSI - Daily / Weekly RSI 1.2", shorttitle = "QRSI", overlay = false, precision = 2, explicit_plot_zorder = true)
// The first setting selects the RSI source independently of the price chart.
string periodChoice = input.string("Daily", "RSI timeframe", options = ["Daily", "Weekly"], display = display.status_line,
tooltip = "Daily uses daily closes. Weekly uses weekly closes. Changing the price chart interval does not change this selection.")
int rsiLength = input.int(14, "RSI length", minval = 1, display = display.none)
color lineColor = input.color(#00A2FF, "RSI line", display = display.none)
int lineWidth = input.int(1, "Line thickness", minval = 1, maxval = 4, display = display.none)
int fillTransparency = input.int(60, "Zone transparency", minval = 0, maxval = 100, display = display.none)
bool showThirtyFive = input.bool(true, "Show 35 guide", display = display.none)
string chosenPeriod = periodChoice == "Weekly" ? "W" : "D"
float rsiValue = request.security(syminfo.tickerid, chosenPeriod, ta.rsi(close, rsiLength), gaps = barmerge.gaps_off, lookahead = barmerge.lookahead_off)
// Each fill is clipped to its own band and disappears when RSI is above it.
float greenEdge = na(rsiValue) ? na : math.min(rsiValue, 30.0)
float yellowEdge = na(rsiValue) ? na : math.min(math.max(rsiValue, 30.0), 35.0)
greenFloor = plot(greenEdge, "Green fill edge", display = display.none, editable = false)
greenCeiling = plot(30.0, "Green fill ceiling", display = display.none, editable = false)
yellowFloor = plot(yellowEdge, "Yellow fill edge", display = display.none, editable = false)
yellowCeiling = plot(35.0, "Yellow fill ceiling", display = display.none, editable = false)
fill(greenFloor, greenCeiling, color = color.new(#00FF00, fillTransparency), title = "Below 30", fillgaps = false)
fill(yellowFloor, yellowCeiling, color = color.new(#FACC15, fillTransparency), title = "30 to 35", fillgaps = false)
hline(70, "70", color = color.new(color.gray, 45), linestyle = hline.style_dashed)
hline(50, "50", color = color.new(color.gray, 45), linestyle = hline.style_dashed)
hline(35, "35", color = showThirtyFive ? color.new(color.gray, 70) : na, linestyle = hline.style_dotted)
hline(30, "30", color = color.new(color.gray, 45), linestyle = hline.style_dashed)
plot(rsiValue, "RSI", color = lineColor, linewidth = lineWidth)