1

Is there any anything I can do in pine script to lock volume profile to right or left side like built-in one, so it won0t move with scrolling or scaling?

Something like like this https://www.tradingview.com/x/vsSBmGRz/

if barstate.isfirst
    vp_first := time
vp_change = change(time)
vp_x_loc = timenow + round(vp_change * vp_bar_offset)

f_setup_bar(n) =>
    x1 = ((vp_VmaxId == n) and vp_poc_show) ? max(time[vp_lookback], vp_first) : 
         (timenow + round(vp_change * (vp_bar_offset - array.get(vp_a_W, n))))
    ys = array.get(vp_a_P, n)
    line.new(x1     = x1, 
             y1     = ys, 
             x2     = vp_x_loc, 
             y2     = ys, 
             xloc   = xloc.bar_time, 
             extend = extend.none, 
             color  = (vp_VmaxId == n ? vp_poc_color : vp_bar_color), 
             style  = line.style_solid, 
             width  = vp_bar_width)

if barstate.islast
    for i = 0 to (vp_N_BARS - 1) by 1
        f_setup_bar(i)
  

I almost tried anything and searched everywhere but I couldn't find the answer. It will be really helpful if someone can help regarding this problem

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
helanom
  • 11
  • 2

0 Answers0