如何在 Pine Script 中绘制 MA 水平线
dma120=request.security(syminfo.tickerid, "D",ta.sma(close,120))
plot(dma120, color= color.blue, title = "D MA120" )
h4ma30=request.security(syminfo.tickerid, "240",ta.sma(close,30))
plot(h4ma30, color= color.red, title = "4H MA30" )
hline(3.14, title='Pi', color=color.blue, linestyle=hline.style_dotted, linewidth=2)
这样就只能绘制线条,无法将MA的值用到HLINE函数中。
它通过使用 Hline 功能以整个布局显示,但我不希望以这种方式显示。我希望它达到我在底部附加的结果。
dma120=request.security(syminfo.tickerid, "D",ta.sma(close,120))
plot(dma120, color= color.blue, title = "D MA120" )
h4ma30=request.security(syminfo.tickerid, "240",ta.sma(close,30))
plot(h4ma30, color= color.red, title = "4H MA30" )
hline(3.14, title='Pi', color=color.blue, linestyle=hline.style_dotted, linewidth=2)
In this way, it can only plot the lines, and it is impossible to use the value of the MA to the HLINE function.
It is displayed in whole layout by using Hline function, but I don't want it in that way. I want it achieved the result that I attached on the bottom.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以通过
line
从图纸。蓝线是
绘图
,黄线是line
。You can do that by using
line
from drawings.Blue line is the
plot
, and yellow line is theline
.