卷松脚本v4

Volume pine script v4

我正在尝试编写一个代码,在栏上方显示一个标签,其音量比之前的音量大 20%。我试过这些解决方案:

a = volume / volume [1]
if a> = 1
     label.new (int (a), close, text = "LONG", color = color.red, style = label.style_xcross, textcolor = color.white, size = size.tiny)

还有这个

max_bars_back (time, 100)
a = volume [1] * 100 / volume
if a> = 2
     label.new (int (a), close, text = "LONG", color = color.red, style = label.style_xcross, textcolor = color.white, size = size.tiny)

像这样:

a = volume [1] * 100 / volume
if a> = 2
     label.new (int (a), close, text = "LONG", color = color.red, style = label.style_xcross, textcolor = color.white, size = size.tiny)

help me compose a code that will display a label above the bar, the volume of which is 20% larger than the previous volume, I tried to do this

试试这个简单的脚本,它应该根据您的条件绘制标签:

//@version=4
study("My Script", overlay=true)
// volume
if volume > volume[1] * 1.2
    label.new(bar_index, high, "V > V[1] more than 1.2 times\n current volume is " + tostring(volume) + "\nprevious volume is " + tostring(volume[1]))