onversion of indicator Liquidity spectrum Visualizer from the TV software

Forums ProRealTime English forum ProBuilder support onversion of indicator Liquidity spectrum Visualizer from the TV software

  • This topic has 1 reply, 2 voices, and was last updated 1 week ago by avatarIván.
Viewing 2 posts - 1 through 2 (of 2 total)
  • #253849
    yys
    indicator(“Liquidity Spectrum Visualizer [BigBeluga]”, overlay = true, max_boxes_count = 500, max_labels_count = 500)
    // INPUTS ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――{
    lookback = input.int(200, “LookBack”)
    vol_bubles = input.bool(true, “Display Volume Bubles”)
    volume_pr = input.bool(true, “Volume Profile”)
    liq_levels = input.bool(true, “Liquidity Levels”)
    col_up = input.color(#22b16c, “”, inline = “colors”)
    col_dn = input.color(#dd7e2a, “”, inline = “colors”)
    // }
    // CALCULATIONS――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――{
    allow = last_bar_index – bar_index < lookback
    display = allow ? display.all : display.none
    n_vol = volume / ta.stdev(volume, 200)
    size = n_vol >= 1 and n_vol < 2 ? size.small : n_vol >= 2 and n_vol < 3 ? size.normal : n_vol >= 3 and n_vol < 4 ? size.large : n_vol >= 4 ? size.huge : size.tiny
    cond0 = n_vol < 1
    cond1 = n_vol >= 1 and n_vol < 2
    cond2=n_vol>=2andn_vol<3
    cond3 = n_vol >= 3 and n_vol < 4
    cond4 = n_vol >= 4
    offset = -lookback-(volume_pr ? 50 : 0)
    if barstate.islast
        h_l = array.new<float>()
        for j = 0 to lookback – 1
            h_l.push(high[j])
            h_l.push(low[j])
        bins = array.new<float>(100)
        step = (h_l.max()-h_l.min()) / 100
        var boxes_bins = array.new<box>()
        var poc_lvls   = array.new<line>()
        for b in boxes_bins
            b.delete()
        for l in poc_lvls
            l.delete()
        boxes_bins.clear()
        poc_lvls.clear()
        for i = 0 to 100-1
            bins.set(i, 0)
        for i = 0 to bins.size()-1
            lower=h_l.min()+step*i
            upper=lower+step
            for j = 0 to lookback – 1
                if high[j] == h_l.max()
                    label.new(bar_index-j, high[j], style = label.style_label_down, text = str.tostring(high[j]), color = col_dn)
                if low[j] == h_l.min()
                    label.new(bar_index-j, low[j], style = label.style_label_up,  text = str.tostring(low[j]), color = col_up)
                c = close[j]
                if c >= lower-step and c <= upper+step
                    bins.set(i, bins.get(i) + volume[j])
        for i = 0 to bins.size()-1
            lower=h_l.min()+step*i
            upper=lower+step
            val = int(bins.get(i)/bins.max() * 50)
            col_res_sup = close > math.avg(upper, lower) ? col_up : col_dn
            if volume_pr
                vp_col = color.from_gradient(val, 0, 50, color.new(col_res_sup, 90), col_res_sup)
                boxes_bins.push(box.new(bar_index+offset, upper, bar_index+val+offset, lower, bgcolor = vp_col, border_color = color(na)))
            if val > 25 and liq_levels
                color_pocs = color.from_gradient(val, 25, 50, color.new(col_res_sup, 90), col_res_sup)
                width = val < 35 ? 1 : val > 35 ? 2 : val > 45 ? 3 : 1
                poc_lvls.push(line.new(bar_index+offset, math.avg(upper, lower), bar_index+5, math.avg(upper, lower), color = color_pocs, width = width))
        box.delete(box.new(bar_index+offset, h_l.max(), bar_index+5, h_l.min(), color.new(chart.fg_color, 50), 1, bgcolor = na)[1])
    // }
    // PLOT ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――{
    colorr = close > open ? col_up: col_dn
    gradient_col = color.from_gradient(n_vol , 0, 5, color.new(colorr, 50), colorr)
    display_vol = vol_bubles ? display.all : display.none
    plotshape(allow and cond0 ? hlc3 : na, “”, shape.circle, location.absolute, gradient_col, 0, “”, na, size = size.tiny, show_last = lookback, force_overlay = true, editable = false, display = display_vol)
    plotshape(allow and cond1 ? hlc3 : na, “”, shape.circle, location.absolute, gradient_col, 0, “”, na, size = size.small, show_last = lookback, force_overlay = true, editable = false, display = display_vol)
    plotshape(allow and cond2 ? hlc3 : na, “”, shape.circle, location.absolute, gradient_col, 0, “”, na, size = size.normal, show_last = lookback, force_overlay = true, editable = false, display = display_vol)
    plotshape(allow and cond3 ? hlc3 : na, “”, shape.circle, location.absolute, gradient_col, 0, “”, na, size = size.large, show_last = lookback, force_overlay = true, editable = false, display = display_vol)
    plotshape(allow and cond4 ? hlc3 : na, “”, shape.circle, location.absolute, gradient_col, 0, “”, na, size = size.huge, show_last = lookback, force_overlay = true, editable = false, display = display_vol)
    // Plot labels for significant volume levels
    if cond4 and allow and vol_bubles
        label.new(bar_index , hlc3, str.tostring(volume, format.volume), xloc.bar_index, yloc.price ,
                     #00000000, label.style_label_center, chart.fg_color, force_overlay = true)
    // }
    #253926

    Hi! here it is:

Viewing 2 posts - 1 through 2 (of 2 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login