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

如何在Pine Script中单独绘制不同震荡指标?

在Pine Script中分离绘制多个震荡指标

你可以通过plot()函数的panel参数,将不同指标分配到独立的子图面板,实现分开绘制的效果。具体修改方法如下:

修改后的代码

indicator("RSI and SRSI", overlay=false)

// Input parameters
length = input.int(14, minval=1, title="RSI Length")
srsi_k = input.int(14, title="SRSI %K Length")
srsi_d = input.int(3, title="SRSI %D Smoothing")

// Calculate RSI
rsi = ta.rsi(close, length)

// Calculate SRSI
srsi = ta.stoch(rsi, rsi, rsi, srsi_k)
srsi_d_value = ta.sma(srsi, srsi_d)

// 将RSI绘制到面板1
plot(rsi, color=color.blue, title="RSI", panel=1)

// 将SRSI的%K和%D绘制到面板2
plot(srsi, color=color.red, title="SRSI %K", panel=2)
plot(srsi_d_value, color=color.green, title="SRSI %D", panel=2)

关键说明

  • panel参数接受整数,不同的整数对应不同的独立子图面板,编号从1开始,编号越小的面板显示位置越靠上。
  • 可以把逻辑相关的指标(比如SRSI的两条线)放在同一个面板,无关指标分配到不同面板,实现分组展示。
  • 如果需要独立坐标轴,可额外添加scale参数(如scale=scale.right),让指标使用右侧坐标轴,进一步区分显示。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.28 19:06:20