[英]How to draw a line on the bar close when the condition is met in Pine Script?
满足条件时,如何在收盘价上连续画一条线?
You can plot with valuewhen.您可以使用 valuewhen 进行绘图。
Example: condition=ta.cross(ta.sma(close,20),ta.sma(close,50)) v=ta.valuewhen(condition,close,0) plot(v)示例:condition=ta.cross(ta.sma(close,20),ta.sma(close,50)) v=ta.valuewhen(condition,close,0) plot(v)
Can you explain further, what exactly you want to do?你能进一步解释一下,你到底想做什么?
line.new()
, which could look like this:line.new()
,它看起来像这样:if condition
line.new(x1, y1, x2, y2)
plot()
and the ternary operator ?:
, which could look like this:plot()
和三元运算符?:
,如下所示:plot(condition ? value : na) // if condition, then plot value, else plot na (like null)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.