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
Iván.
Viewing 2 posts - 1 through 2 (of 2 total)
-
-
11/21/2025 at 10:18 AM #253849indicator(“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 < lookbackdisplay = allow ? display.all : display.nonen_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.tinycond0 = n_vol < 1cond1 = n_vol >= 1 and n_vol < 2cond2=n_vol>=2andn_vol<3cond3 = n_vol >= 3 and n_vol < 4cond4 = n_vol >= 4offset = -lookback-(volume_pr ? 50 : 0)if barstate.islasth_l = array.new<float>()for j = 0 to lookback – 1h_l.push(high[j])h_l.push(low[j])bins = array.new<float>(100)step = (h_l.max()-h_l.min()) / 100var boxes_bins = array.new<box>()var poc_lvls = array.new<line>()for b in boxes_binsb.delete()for l in poc_lvlsl.delete()boxes_bins.clear()poc_lvls.clear()for i = 0 to 100-1bins.set(i, 0)for i = 0 to bins.size()-1lower=h_l.min()+step*iupper=lower+stepfor j = 0 to lookback – 1if 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+stepbins.set(i, bins.get(i) + volume[j])for i = 0 to bins.size()-1lower=h_l.min()+step*iupper=lower+stepval = int(bins.get(i)/bins.max() * 50)col_res_sup = close > math.avg(upper, lower) ? col_up : col_dnif volume_prvp_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_levelscolor_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 : 1poc_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_dngradient_col = color.from_gradient(n_vol , 0, 5, color.new(colorr, 50), colorr)display_vol = vol_bubles ? display.all : display.noneplotshape(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 levelsif cond4 and allow and vol_bubleslabel.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)// }11/24/2025 at 1:27 PM #253926
Hi! here it is:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211// --------------------------------------------// PRC_Liquidity Spectrum Visualizer// version = 0// 24.11.2025// Iván González @ www.prorealcode.com// Sharing ProRealTime knowledge// --------------------------------------------// Definable parameters (Initial configuration)// --------------------------------------------lookback = 200 // Analysis periodshowBubbles = 1 // 1 = Yes, 0 = NoshowVP = 1 // 1 = Yes, 0 = No (Volume Profile)showLiqLevels = 1 // 1 = Yes, 0 = No (Liquidity levels)// --------------------------------------------// Color Configuration (RGB)// --------------------------------------------// Bullish Color (Pine Green type)rUp = 34gUp = 177bUp = 76// Bearish Color (Pine Orange type)rDn = 221gDn = 126bDn = 42// -------------------------------------------------------------// 1. VOLUME BUBBLES CALCULATION// -------------------------------------------------------------// Calculate volume standard deviationvolStdev = STD[200](Volume)// Normalize volume (Simplified Z-Score)// Avoid division by zeronVol = 0IF volStdev > 0 THENnVol = Volume / volStdevENDIF// Determine point size based on volume magnitudeipointSize = 0IF nVol >= 1 AND nVol < 2 THENipointSize = 1ELSIF nVol >= 2 AND nVol < 3 THENipointSize = 2ELSIF nVol >= 3 AND nVol < 4 THENipointSize = 3ELSIF nVol >= 4 THENipointSize = 4ENDIF// Determine bubble colorrDraw = rDngDraw = gDnbDraw = bDnIF Close > Open THENrDraw = rUpgDraw = gUpbDraw = bUpENDIF// Calculate opacity based on size (larger = more opaque)alpha = 50 + (ipointSize * 40)if alpha > 255 THENalpha = 255ENDIF// Use typical price (HLC3) for locationmyPrice = (High + Low + Close) / 3// Draw bubblesIF islastbarupdate and showBubbles THENfor i=0 to lookback-1 do// Determine point size based on volume magnitude using historical dataIF nVol[i] >= 1 AND nVol[i] < 2 THENDRAWPOINT(barindex[i], myPrice[i],2) COLOURED(rDraw[i], gDraw[i], bDraw[i], alpha[i])ELSIF nVol[i] >= 2 AND nVol[i] < 3 THENDRAWPOINT(barindex[i], myPrice[i],3) COLOURED(rDraw[i], gDraw[i], bDraw[i], alpha[i])ELSIF nVol[i] >= 3 AND nVol[i] < 4 THENDRAWPOINT(barindex[i], myPrice[i],4) COLOURED(rDraw[i], gDraw[i], bDraw[i], alpha[i])ELSIF nVol[i] >= 4 THENDRAWPOINT(barindex[i], myPrice[i],5) COLOURED(rDraw[i], gDraw[i], bDraw[i], alpha[i])ENDIF// If volume is extreme (>=4), place text labelIF nVol[i] >= 4 THENmyvol=volume[i]DRAWTEXT("#myvol#", barindex[i], myPrice[i]) ANCHOR(TOP,INDEX,VALUE) COLOURED(rDraw[i], gDraw[i], bDraw[i], 255)ENDIFnextendif// -------------------------------------------------------------// 2. VOLUME PROFILE AND LIQUIDITY LEVELS// -------------------------------------------------------------IF showVP AND IsLastBarUpdate THEN// Find maximum and minimum of the lookback rangehighestPrice = Highest[lookback](High)lowestPrice = Lowest[lookback](Low)// Define size of each 'box' or bin (100 levels)priceRange = highestPrice - lowestPricestepSize = priceRange / 100// Clear volume bins arrayUNSET($volBins)// LOOP 1: Fill bins with volume// Loop through the last 'lookback' candles backwardsFOR j = 0 TO lookback - 1 DO// Get close price and volume of that historical candlehistClose = Close[j]histVol = Volume[j]// Calculate which array index corresponds to this price// Index 0 is the lowest price, 99 the highestbinIndex = FLOOR((histClose - lowestPrice) / stepSize)// Protect array limits (0 to 99)IF binIndex < 0 THENbinIndex = 0ELSIF binIndex > 99 THENbinIndex = 99ENDIF// Accumulate volume at that price levelif IsSet($volBins[binIndex]) THEN$volBins[binIndex] = $volBins[binIndex] + histVolELSE$volBins[binIndex] = histVolENDIFNEXT// Find maximum volume to scale the drawing (normalization)maxBinVol = ArrayMax($volBins)// Visual offset (places the VP start at the beginning of the lookback)offset = -lookback// LOOP 2: Draw profileFOR i = 0 TO 99 DO// Define Y coordinates (Prices)yBottom = lowestPrice + (stepSize * i)yTop = yBottom + stepSizeyMid = (yTop + yBottom) / 2// Get level volumecurrentBinVol = 0IF IsSet($volBins[i]) THENcurrentBinVol = $volBins[i]ENDIF// Calculate bar length (max 50 candles width)barLength = 0IF maxBinVol > 0 THENbarLength = ROUND((currentBinVol / maxBinVol) * 50)ENDIFIF barLength > 0 THEN// Determine level color (if current price is above or below this level)rLvl = rDngLvl = gDnbLvl = bDnIF Close > yMid THENrLvl = rUpgLvl = gUpbLvl = bUpENDIF// Simulated gradient with transparency// More volume = more opaquealphaLvl = ROUND((currentBinVol / maxBinVol) * 150) + 20// RECTANGLE DRAWING (Volume Profile)// Draw from the past anchor point to the rightDRAWRECTANGLE(barindex + offset, yTop, barindex + offset + barLength, yBottom) COLOURED(rLvl, gLvl, bLvl, alphaLvl) BORDERCOLOR(0,0,0,0)// LIQUIDITY LEVELS DRAWING (Poc Extensions)// If volume is significant (>25% of max), extend a lineIF showLiqLevels AND (currentBinVol / maxBinVol) > 0.25 THENif (currentBinVol / maxBinVol) > 0.75 THEN// Small horizontal line marking the liquidity level (High significance)DRAWSEGMENT(barindex + offset, yMid, barindex , yMid) STYLE(LINE, 3) COLOURED(rLvl, gLvl, bLvl, 155)elsif (currentBinVol / maxBinVol) > 0.50 THEN// Medium significanceDRAWSEGMENT(barindex + offset, yMid, barindex , yMid) STYLE(LINE, 2) COLOURED(rLvl, gLvl, bLvl, 70)elsif (currentBinVol / maxBinVol) > 0.40 THEN// Low significanceDRAWSEGMENT(barindex + offset, yMid, barindex , yMid) STYLE(LINE, 2) COLOURED(rLvl, gLvl, bLvl, 55)else// Minimal significance (Dotted)DRAWSEGMENT(barindex + offset, yMid, barindex , yMid) STYLE(LINE, 1) COLOURED(rLvl, gLvl, bLvl, 35)style(dottedline)endifENDIFENDIFNEXT// Range Maximum and Minimum labelsDRAWTEXT("High Range: #highestPrice#", barindex + offset, highestPrice) ANCHOR(BOTTOM,INDEX,VALUE) COLOURED(rDn, gDn, bDn, 200)DRAWTEXT("Low Range: #lowestPrice#", barindex + offset, lowestPrice) ANCHOR(TOP,INDEX,VALUE) COLOURED(rUp, gUp, bUp, 200)// Draw analysis box backgrounddrawrectangle(barindex+offset,highestPrice,barindex,lowestPrice)coloured("grey",50)ENDIFRETURN -
AuthorPosts
Viewing 2 posts - 1 through 2 (of 2 total)
Find exclusive trading pro-tools on 
Similar topics: