![](/img/trans.png)
[英]How to draw a line on the bar close when the condition is met in Pine Script?
[英]Draw vertical line at the first bar of the month in tradingview's pine script
我想在一个月(对于日线图和周线图)或一年(对于月线图)的每个第一条柱上画一条垂直虚线。 我怎样才能做到这一点? 我不知道如何获得这些条形索引。
另外:我在这篇文章中读到,“line.new”对每个指标最多 54 行有限制。 但是当以直方图样式使用绘图函数时(=仅绘制单个垂直直方图条),我无法绘制虚线......我更喜欢带有虚线的解决方案......
这是midtownsk8rguy代码适应这里:
//@version=4
study("Periodic Vline", overlay=true)
p = timeframe.ismonthly ? "12M" : "M"
vline(BarIndex, Color, LineStyle, LineWidth) =>
return = line.new(BarIndex, low - tr, BarIndex, high + tr, xloc.bar_index, extend.both, Color, LineStyle, LineWidth)
if change(time(p))
vline(bar_index, #FF800080, line.style_dashed, 1)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.