You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何将RSI指标的显示范围锁定在0-100区间?

如何将RSI指标图表范围锁定在0-100区间

可以通过修改Pine Script代码实现RSI图表范围固定在0-100区间,需要两处关键调整:

  • 在indicator()函数中添加scale=scale.none参数,让指标使用独立刻度面板,不受主图刻度影响
  • 在plot()函数中指定minval=0和maxval=100,强制限制RSI线的显示范围

修改后的完整代码如下:

//@version=5
indicator(title="Relative Strength Index", shorttitle="RSI", format=format.price, precision=2, timeframe="", timeframe_gaps=true, scale=scale.none)
len = input.int(14, minval=1, title="Length")
src = input(close, "Source")
up = ta.rma(math.max(ta.change(src), 0), len)
down = ta.rma(-math.min(ta.change(src), 0), len)
rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down))
plot(rsi, "RSI", color=#ffffff, minval=0, maxval=100)
band1 = hline(60, "Upper Band", color=#787B86)
bandm = hline(50, "Middle Band", color=color.new(#787B86, 50))
band0 = hline(40, "Lower Band", color=#787B86)

修改完成后,RSI指标的显示面板会固定在0-100区间,不会随RSI数值波动自动调整范围。

内容的提问来源于stack exchange,提问作者hafidzaini

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.12 17:30:13