自动缩放垂直线宽

时间:2021-01-10 10:10:06

标签: pine-script

我正在使用函数 line.set 绘制垂直线 是否可以自动调整垂直线宽,使其等于烛台宽度。 或其他不使用 plot 的绘图可能性。

[添加]

study("V_Line")

var bar0 = line.new(na, na, na, na, width=5, extend=extend.none)
var bar1 = line.new(na, na, na, na, width=5, extend=extend.none)
var bar2 = line.new(na, na, na, na, width=5, extend=extend.none)
vol=0.0

vcolor = close[2] < close[0] and close[1] < close[0] ? color.green : (close[2] > close[0] and close[1] > close[0] ? color.red : color.black)
vol := vcolor[1]==vcolor[0]  ?  nz(vol[1]) + nz(volume) : nz(volume)

line.set_xy1(bar0, bar_index, 0)
line.set_xy2(bar0, bar_index, vol)
line.set_color(bar0, vcolor)

line.set_xy1(bar1, bar_index[1], 0)
line.set_xy2(bar1, bar_index[1], vol[1])
line.set_color(bar1, vcolor[1])

line.set_xy1(bar2, bar_index[2], 0)
line.set_xy2(bar2, bar_index[2], vol[2])
line.set_color(bar2, vcolor[2])

enter image description here

1 个答案:

答案 0 :(得分:1)

喜欢吗?

<select class="form-control">
   <option>Year</option>
   @foreach(range(date('Y')-16, date('Y')-70) as $y)
      <option>{{$y}}</option>
   @endforeach
 </select>

enter image description here