【发布时间】:2020-02-15 21:41:45
【问题描述】:
我想在每个月的第一条柱(对于日线图和周线图)或一年(对于月线图)绘制一条垂直虚线。 我怎样才能做到这一点?我不知道如何获取那些条形索引。
补充: 我读了 this post "line.new" 限制每个指标最多 54 行。但是当以直方图样式使用绘图功能时(=仅绘制单个垂直直方图条),我无法绘制虚线......我更喜欢用虚线的解决方案......
【问题讨论】:
标签: plot line draw pine-script
我想在每个月的第一条柱(对于日线图和周线图)或一年(对于月线图)绘制一条垂直虚线。 我怎样才能做到这一点?我不知道如何获取那些条形索引。
补充: 我读了 this post "line.new" 限制每个指标最多 54 行。但是当以直方图样式使用绘图功能时(=仅绘制单个垂直直方图条),我无法绘制虚线......我更喜欢用虚线的解决方案......
【问题讨论】:
标签: plot line draw pine-script
这是对midtownsk8rguy的代码here的改编:
//@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)
【讨论】: