Pine script 在内置指示器上画水平线

Pine script 在内置指示器上画水平线,pine-script,Pine Script,我想在一个内置指示器上画两条水平线。 我已尝试创建自定义脚本: study("Lines") p1 = plot(0.1) p2 = plot(0.25) fill(p1, p2, color=green) 因此,我可以在一个单独的小部件中画出这条线,但是我如何在另一个指示器()上画出它们呢?这就是您想要实现的目标吗 //@version=1 study(title="Relative Strength Index", shorttitle="My StockRSI with RSI") sr

我想在一个内置指示器上画两条水平线。
我已尝试创建自定义脚本:

study("Lines")
p1 = plot(0.1)
p2 = plot(0.25)
fill(p1, p2, color=green)

因此,我可以在一个单独的小部件中画出这条线,但是我如何在另一个指示器()上画出它们呢?

这就是您想要实现的目标吗

//@version=1
study(title="Relative Strength Index", shorttitle="My StockRSI with RSI")
src = close, len = input(8, minval=1, title="Length")
up = rma(max(change(src), 0), len)
down = rma(-min(change(src), 0), len)
rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down))

plot(rsi, title='RSI',color=#0000ff, transp=0, linewidth=1)
band2 = hline(70, title="Upper band", color=red, linestyle=solid, linewidth=1)
band1 = hline(50, title="Middle band", color=olive, linestyle=solid, linewidth=1)
band0 = hline(30, title="Lower band", color=teal, linestyle=solid, linewidth=1)


//Stochastic RSI//
smoothK = input(3, minval=1)
smoothD = input(3, minval=1)
lengthRSI = input(14, minval=1)
lengthStoch = input(14, minval=1)

rsi1 = rsi(src, lengthRSI)
k = sma(stoch(rsi1, rsi1, rsi1, lengthStoch), smoothK)
d = sma(k, smoothD)

plot(k, title='Smooth K',color=teal, transp=10)
plot(d, title='Smooth D',color=#ff7f00, transp=10)

h0 = hline(100, title="Upper band", linestyle=solid, linewidth=1, color=olive)
h1 = hline(0, title="Lower band", linestyle=solid, linewidth=1, color=olive)

您是否将
overlay=true
添加到您的
study()