在蜡烛上创建音量点

时间:2020-05-29 08:19:46

标签: pine-script

我想指出一个带有垂直线的烛台上的最高音量。现在,我仅在烛台的主体内部看到此点(在灯芯中未看到此点)。我将灯芯包括在内。有人可以帮忙吗?

//@version=4
study("Name", overlay=true)
i = input(1, title="Volume Periods")
Name = barssince(volume == max(highest(volume, i), 0))
plot(close[Name], color=color.black, title="Name", style=plot.style_circles)

enter image description here

水平线的长度应该短些。

2 个答案:

答案 0 :(得分:0)

highestbars()将偏移量返回到最大值:

//@version=4
study("Name", overlay=true)
i = input(10, title="Volume Periods")
ofst = - highestbars(volume, i)
line.new(bar_index[ofst], low[ofst], bar_index[ofst], high[ofst], color = color.new(color.silver, 0), width = 3)

enter image description here

答案 1 :(得分:0)

在PineScript中绘制垂直线非常棘手,可能会导致缩放问题。
可以找到一些示例here

最好在情况出现时突出显示背景。

//@version=4
study("Name", overlay=true)
i = input(20, title="Volume Periods")
bgcolor(volume == highest(volume,i) ? color.yellow : na)

哪个产量

Background highlighted on condition