Indicator · Pine Script v6 · Own pane

Better Volume PRO v2.0 (Enhanced + Stats)

by bot-trading-project

Better Volume PRO v2.0 calculates volume distribution, estimating buying and selling pressure to derive a volume delta and confidence score.

View on GitHub

GitHub stars2on the repository
Pine versionv6current
Lines of code383
Settings40inputs
LicenceMIT
Last update11 months ago23 Nov 2025

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.

Source Code

383 lines of Pine Script v6 from BV Pro v2.0 (Enhanced + Stats).txt, published under MIT. Keep the author's credit and licence lines when you reuse it.

BV Pro v2.0 (Enhanced + Stats).txt
//@version=6
indicator('Better Volume PRO v2.0 (Enhanced + Stats)', shorttitle = 'BV PRO v2', overlay = false, precision = 2)

//================ INPUTS BÁSICOS
len = input.int(20, 'Lookback Period', minval = 5, maxval = 100)
hotPct = input.float(60, 'Hot Volume Threshold (%)', minval = 5, maxval = 400, step = 5)
minConfidence = input.int(70, 'Minimum Confidence for Signals (%)', minval = 0, maxval = 100, step = 5)

//================ 🆕 MA TYPE SELECTOR
maType = input.string('EMA', 'MA Type', options = ['SMA', 'EMA'], group = 'Calculation', tooltip = 'SMA = Suavizado (menos ruido) | EMA = Reactivo (detecta cambios rápido)')

//================ 🆕 AGREGACIÓN HISTÓRICA (LOOKBACK AUMENTADO)
statsLookback = input.int(10, 'Stats Lookback Period', minval = 3, maxval = 500, group = 'Historical Stats', tooltip = 'Número de velas para calcular estadísticas agregadas (recomendado: 5m=100, 15m=50-100, 1H=24-48)')
showStats = input.bool(true, 'Show Historical Stats in Table', group = 'Historical Stats')

//================ OPCIONES DE CÁLCULO
useTR = input.bool(true, 'Use True Range for Climax/Churn', group = 'Calculation')
useVWAP = input.bool(true, 'Use VWAP for Confidence Adjustment', group = 'Calculation')
filterDoji = input.bool(true, 'Filter Doji Candles (body <30%)', group = 'Calculation')
useMultibar = input.bool(true, 'Consider Multi-Bar Consistency', group = 'Calculation')

//================ VISUALIZACIÓN: VOLUMEN Y DELTA
stacked = input.bool(true, 'Show Stacked (Buy Up / Sell Down)', group = 'Display - Volume')
volTransparency = input.int(25, 'Volume Transparency', minval = 0, maxval = 90, step = 5, group = 'Display - Volume', tooltip = 'Menor valor = colores más intensos (recomendado: 20-30)')
buyVolColor = input.color(color.rgb(0, 255, 0), 'Buy Volume Color', group = 'Display - Volume')
sellVolColor = input.color(color.rgb(255, 0, 0), 'Sell Volume Color', group = 'Display - Volume')

showVolMA = input.bool(true, 'Show Volume MA Line', group = 'Display - Volume')
volMAColor = input.color(color.rgb(255, 215, 0), 'Volume MA Color', group = 'Display - Volume')
volMAWidth = input.int(2, 'Volume MA Width', minval = 1, maxval = 4, group = 'Display - Volume')

showDelta = input.bool(true, 'Show Delta Line', group = 'Display - Delta')
deltaWidth = input.int(2, 'Delta Line Width', minval = 1, maxval = 5, group = 'Display - Delta')
deltaColorBuy = input.color(color.rgb(0, 255, 0), 'Delta Buy Color', group = 'Display - Delta')
deltaColorSell = input.color(color.rgb(255, 0, 0), 'Delta Sell Color', group = 'Display - Delta')

//================ VISUALIZACIÓN: SEÑALES
showConfLine = input.bool(true, 'Show Confidence Line', group = 'Display - Confidence')
confLineColor = input.color(color.blue, 'Confidence Line Color', group = 'Display - Confidence')

// Control individual de señales
showHotVol = input.bool(true, 'Show HOT Volume', group = 'Signals')
showBuySignals = input.bool(true, 'Show BUY Signals', group = 'Signals')
showSellSignals = input.bool(true, 'Show SELL Signals', group = 'Signals')
showDivergences = input.bool(false, 'Show Divergences', group = 'Signals')

// Colores de señales
hotVolColor = input.color(color.rgb(255, 165, 0), 'HOT Volume Color', group = 'Signal Colors')
buyColor = input.color(color.rgb(0, 255, 0), 'BUY Signal Color', group = 'Signal Colors')
sellColor = input.color(color.rgb(255, 0, 0), 'SELL Signal Color', group = 'Signal Colors')
bullDivColor = input.color(color.rgb(0, 200, 0), 'Bullish Divergence Color', group = 'Signal Colors')
bearDivColor = input.color(color.rgb(200, 0, 0), 'Bearish Divergence Color', group = 'Signal Colors')

//================ 🎨 TABLA - CONTROLES VISUALES MEJORADOS
showTbl = input.bool(true, 'Show Metrics Table', group = 'Table')
tableSize = input.string('normal', 'Table Text Size', options = ['tiny', 'small', 'normal', 'large'], group = 'Table')

// 🆕 CONTROLES DE TRANSPARENCIA
tableBgTransparency = input.int(0, 'Table Background Transparency', minval = 0, maxval = 90, step = 5, group = 'Table', tooltip = 'Menor valor = fondo más sólido (recomendado: 0-10)')
tableHeaderBgTransparency = input.int(20, 'Table Header Transparency', minval = 0, maxval = 90, step = 5, group = 'Table')
tableCellBgTransparency = input.int(60, 'Table Cell Background Transparency', minval = 0, maxval = 90, step = 5, group = 'Table')

// 🆕 COLORES DE TABLA PERSONALIZABLES
tableHeaderBgColor = input.color(color.rgb(40, 40, 40), 'Table Header Background', group = 'Table')
tableHeaderTextColor = input.color(color.white, 'Table Header Text', group = 'Table')
tableBorderColor = input.color(color.rgb(120, 120, 120), 'Table Border Color', group = 'Table')

//================ FUNCIONES AUXILIARES
eps = 1e-10
safe(x) => math.max(x, eps)

// Función para convertir string a size para tabla
getTableSize(s) =>
    s == 'tiny' ? size.tiny : s == 'small' ? size.small : s == 'normal' ? size.normal : size.large

// 🆕 FUNCIÓN PARA FORMATEAR VOLUMEN ADAPTATIVAMENTE
formatVolume(vol) =>
    absVol = math.abs(vol)
    result = ''
    if absVol >= 1000000
        // Mostrar en millones (M)
        result := str.tostring(vol / 1e6, '#.##') + 'M'
    else if absVol >= 1000
        // Mostrar en miles (K)
        result := str.tostring(vol / 1e3, '#.##') + 'K'
    else
        // Mostrar número directo
        result := str.tostring(vol, '#.##')
    result

// 🆕 FUNCIÓN PARA CALCULAR MA DINÁMICA (SMA o EMA)
calcMA(src, length) =>
    maType == 'EMA' ? ta.ema(src, length) : ta.sma(src, length)

//================ CÁLCULOS BASE
rng = high - low
tr = ta.tr(true)
span = useTR ? tr : rng

vwap = ta.vwap(hlc3)

inRange = rng > 0
buyEstBase = inRange ? volume * (close - low) / safe(rng) : volume * 0.5
sellEstBase = volume - buyEstBase
deltaBase = buyEstBase - sellEstBase

//================ CONFIDENCE SCORE
body = math.abs(close - open)
bodyPct = body / safe(rng)
upperWick = high - math.max(close, open)
lowerWick = math.min(close, open) - low
wicksPct = (upperWick + lowerWick) / safe(rng)

structureScore = filterDoji and bodyPct < 0.30 ? 0.0 : bodyPct * (1.0 - wicksPct * 0.5)
structureScore := math.max(0.0, math.min(1.0, structureScore))

vwapDist = useVWAP ? math.abs(close - vwap) / safe(close) : 0.0
closeAboveVwap = close > vwap and deltaBase > 0
closeBelowVwap = close < vwap and deltaBase < 0
vwapScore = useVWAP ? (closeAboveVwap or closeBelowVwap ? 1.0 - vwapDist * 5 : 0.5) : 1.0
vwapScore := math.max(0.0, math.min(1.0, vwapScore))

// 🆕 VOLUME MA CON MA TYPE CONFIGURABLE
volMA = calcMA(volume, len)
volRatio = volume / safe(volMA)
volScore = volRatio > 1.5 ? 1.0 : volRatio > 1.0 ? 0.8 : volRatio > 0.7 ? 0.6 : 0.3

delta1 = deltaBase[1]
delta2 = deltaBase[2]
sameDir = (deltaBase > 0 and delta1 > 0) or (deltaBase < 0 and delta1 < 0)
sameDirStrong = (deltaBase > 0 and delta1 > 0 and delta2 > 0) or (deltaBase < 0 and delta1 < 0 and delta2 < 0)
sameDirection = useMultibar ? (sameDir ? 0.8 : 0.5) : 1.0
sameDirection := sameDirStrong ? 1.0 : sameDirection

confidenceRaw = (structureScore * 0.40 + vwapScore * 0.30 + volScore * 0.20 + sameDirection * 0.10)
confidence = confidenceRaw * 100.0

//================ DELTA AJUSTADO
confWeight = confidence / 100.0
buyEstAdj = buyEstBase * confWeight + volume * 0.5 * (1.0 - confWeight)
sellEstAdj = volume - buyEstAdj
deltaAdj = buyEstAdj - sellEstAdj

//================ 🆕 ESTADÍSTICAS AGREGADAS (LOOKBACK CON MA CONFIGURABLE)
// AVG CONFIDENCE CON MA TYPE CONFIGURABLE
avgConfidence = calcMA(confidence, statsLookback)

// Cumulative Delta (suma últimas N velas)
cumulativeDelta = math.sum(deltaAdj, statsLookback)

// Buy Pressure % (porcentaje de velas con delta positivo)
buyPressureCount = 0
for i = 0 to statsLookback - 1
    if deltaAdj[i] > 0
        buyPressureCount += 1
buyPressurePct = (buyPressureCount / statsLookback) * 100

// 🆕 SELL PRESSURE % (complemento de Buy Pressure)
sellPressurePct = 100.0 - buyPressurePct

// 🆕 DELTA MOMENTUM (delta actual vs promedio histórico)
avgDelta = calcMA(deltaAdj, statsLookback)
deltaMomentum = deltaAdj - avgDelta

// 🆕 VOLUME MOMENTUM (volumen actual vs promedio histórico del statsLookback)
volAvgStats = calcMA(volume, statsLookback)
volumeMomentum = ((volume - volAvgStats) / safe(volAvgStats)) * 100

// 🆕 NET PRESSURE SCORE (-100 a +100)
// Componente 1: Delta Score (40% del total)
cumDeltaMM = cumulativeDelta / 1e6
deltaScore = cumDeltaMM > 0 ? math.min(40, cumDeltaMM * 0.5) : math.max(-40, cumDeltaMM * 0.5)

// Componente 2: Buy Pressure Score (30% del total)
buyPressureScore = (buyPressurePct - 50) * 0.6  // Convierte 0-100% a -30 a +30

// Componente 3: Confidence Score (30% del total)
confScore = (avgConfidence - 50) * 0.6  // Convierte 0-100% a -30 a +30

// Net Pressure combinado
netPressureRaw = deltaScore + buyPressureScore + confScore
netPressure = math.max(-100, math.min(100, netPressureRaw))

// High Confidence Count (cuántas velas con confidence ≥ minConfidence)
highConfCount = 0
for i = 0 to statsLookback - 1
    if confidence[i] >= minConfidence
        highConfCount += 1

//================ LÓGICA BETTER VOLUME
vr = volume * safe(span)
vrHi = ta.highest(vr, len)
isClimax = vr >= vrHi

churnM = volume / safe(span)
churnHi = ta.highest(churnM, len)
isChurn = churnM >= churnHi

isLowVol = volume <= ta.lowest(volume, len)
upCandle = close > open
downCandle = close < open

// Color por clasificación BV
var color col = color.gray
if isClimax and isChurn
    col := color.new(color.fuchsia, 0)
else if isClimax and upCandle
    col := color.new(color.lime, 0)
else if isClimax and downCandle
    col := color.new(color.red, 0)
else if isChurn
    col := color.new(color.yellow, 0)
else if isLowVol
    col := color.new(color.aqua, 0)
else
    col := color.new(color.gray, 50)

//================ HOT VOLUME
excessP = 100.0 * (volume / safe(volMA) - 1.0)
isHot = excessP >= hotPct

//================ SEÑALES
isHighConfBuy = deltaAdj > 0 and confidence >= minConfidence and (isClimax or isHot)
isHighConfSell = deltaAdj < 0 and confidence >= minConfidence and (isClimax or isHot)

priceHH = high > ta.highest(high[1], 5)
volLH = volume < ta.highest(volume[1], 5)
bearDiv = priceHH and volLH and deltaAdj < 0

priceLL = low < ta.lowest(low[1], 5)
volLH2 = volume < ta.highest(volume[1], 5)
bullDiv = priceLL and volLH2 and deltaAdj > 0

//================ PLOTS - VOLUMEN (🎨 Colores mejorados)
volColorBuy = color.new(buyVolColor, volTransparency)
volColorSellPlot = color.new(sellVolColor, volTransparency)

plot(stacked ? buyEstAdj : na, title = 'Buy Volume', style = plot.style_columns, color = volColorBuy)
plot(stacked ? -sellEstAdj : na, title = 'Sell Volume', style = plot.style_columns, color = volColorSellPlot)
plot(stacked ? na : volume, title = 'Volume', style = plot.style_columns, color = col)

plot(showVolMA ? volMA : na, title = 'Volume MA', color = volMAColor, linewidth = volMAWidth)

//================ PLOTS - DELTA
deltaTransparency = int(100 - confidence)
deltaColor = deltaAdj >= 0 ? color.new(deltaColorBuy, deltaTransparency) : color.new(deltaColorSell, deltaTransparency)
plot(showDelta ? deltaAdj : na, title = 'Delta', color = deltaColor, linewidth = deltaWidth)
hline(0, 'Zero Line', color = color.new(color.gray, 50), linestyle = hline.style_dotted)

//================ PLOTS - CONFIDENCE
plot(showConfLine ? confidence : na, title = 'Confidence %', color = color.new(confLineColor, 60), linewidth = 1)
hline(minConfidence, 'Min Confidence', color = color.new(color.orange, 70), linestyle = hline.style_dashed)

//================ SEÑALES VISUALES (tamaño fijo size.small)
plotshape(showHotVol and isHot, title = 'HOT Volume', style = shape.diamond, size = size.small, color = hotVolColor, location = location.top)

plotshape(showBuySignals and isHighConfBuy, title = 'BUY', style = shape.triangleup, size = size.small, color = buyColor, location = location.bottom, text = 'BUY', textcolor = color.white)

plotshape(showSellSignals and isHighConfSell, title = 'SELL', style = shape.triangledown, size = size.small, color = sellColor, location = location.top, text = 'SELL', textcolor = color.white)

plotshape(showDivergences and bearDiv, title = 'Bear Div', style = shape.xcross, size = size.small, color = bearDivColor, location = location.top, text = 'DIV-')

plotshape(showDivergences and bullDiv, title = 'Bull Div', style = shape.xcross, size = size.small, color = bullDivColor, location = location.bottom, text = 'DIV+')

//================ 🎨 TABLA HORIZONTAL CON CONTROLES VISUALES MEJORADOS + STATS COMPLETAS
tSize = getTableSize(tableSize)

// 🔥 CAMBIO PRINCIPAL: Tabla horizontal
// Ajustar número de columnas según si mostramos stats
numCols = showStats ? 14 : 6  // 5 métricas actuales + 9 stats históricas = 14 total

var tbl = table.new(position.bottom_right, numCols, 2, border_width = 2, border_color = tableBorderColor)

if barstate.islast and showTbl
    colIdx = 0
    
    // ========== FILA 0: HEADERS ==========
    
    // CONFIDENCE
    var color confBg = color.green
    var color confTxt = color.lime
    if confidence >= 70
        confBg := color.new(color.rgb(0, 180, 0), tableHeaderBgTransparency)
        confTxt := color.rgb(0, 255, 0)
    else if confidence >= 40
        confBg := color.new(color.rgb(255, 140, 0), tableHeaderBgTransparency)
        confTxt := color.rgb(255, 220, 0)
    else
        confBg := color.new(color.rgb(220, 0, 0), tableHeaderBgTransparency)
        confTxt := color.rgb(255, 80, 80)
    
    table.cell(tbl, colIdx, 0, 'Confidence', text_color = tableHeaderTextColor, bgcolor = confBg, text_size = tSize)
    table.cell(tbl, colIdx, 1, str.tostring(math.round(confidence)) + '%', text_color = confTxt, text_size = tSize, bgcolor = color.new(color.black, tableBgTransparency))
    colIdx += 1
    
    // BUY VOLUME
    table.cell(tbl, colIdx, 0, 'Buy Vol', text_color = color.rgb(0, 255, 0), bgcolor = color.new(color.rgb(0, 120, 0), tableHeaderBgTransparency), text_size = tSize)
    table.cell(tbl, colIdx, 1, formatVolume(buyEstAdj), text_color = color.white, text_size = tSize, bgcolor = color.new(color.black, tableBgTransparency))
    colIdx += 1
    
    // SELL VOLUME
    table.cell(tbl, colIdx, 0, 'Sell Vol', text_color = color.rgb(255, 80, 80), bgcolor = color.new(color.rgb(120, 0, 0), tableHeaderBgTransparency), text_size = tSize)
    table.cell(tbl, colIdx, 1, formatVolume(sellEstAdj), text_color = color.white, text_size = tSize, bgcolor = color.new(color.black, tableBgTransparency))
    colIdx += 1
    
    // DELTA
    table.cell(tbl, colIdx, 0, 'Delta', text_color = color.white, bgcolor = color.new(color.rgb(60, 60, 60), tableHeaderBgTransparency), text_size = tSize)
    deltaColorTbl = deltaAdj >= 0 ? color.rgb(0, 255, 0) : color.rgb(255, 80, 80)
    table.cell(tbl, colIdx, 1, formatVolume(deltaAdj), text_color = deltaColorTbl, text_size = tSize, bgcolor = color.new(color.black, tableBgTransparency))
    colIdx += 1
    
    // VOL EXCESS
    table.cell(tbl, colIdx, 0, 'Vol Excess', text_color = color.rgb(255, 180, 0), bgcolor = color.new(color.rgb(160, 80, 0), tableHeaderBgTransparency), text_size = tSize)
    excessColor = excessP >= hotPct ? color.rgb(255, 180, 0) : color.white
    table.cell(tbl, colIdx, 1, str.tostring(math.round(excessP)) + '%', text_color = excessColor, text_size = tSize, bgcolor = color.new(color.black, tableBgTransparency))
    colIdx += 1
    
    // ========== 🆕 SECCIÓN DE ESTADÍSTICAS AGREGADAS (HORIZONTAL) ==========
    if showStats
        // AVG CONFIDENCE
        avgConfBg = avgConfidence >= 70 ? color.new(color.rgb(0, 180, 0), tableHeaderBgTransparency) : avgConfidence >= 40 ? color.new(color.rgb(255, 140, 0), tableHeaderBgTransparency) : color.new(color.rgb(220, 0, 0), tableHeaderBgTransparency)
        avgConfTxt = avgConfidence >= 70 ? color.rgb(0, 255, 0) : avgConfidence >= 40 ? color.rgb(255, 220, 0) : color.rgb(255, 80, 80)
        table.cell(tbl, colIdx, 0, 'Avg Conf [' + str.tostring(statsLookback) + ']', text_color = tableHeaderTextColor, bgcolor = avgConfBg, text_size = tSize)
        table.cell(tbl, colIdx, 1, str.tostring(math.round(avgConfidence)) + '%', text_color = avgConfTxt, text_size = tSize, bgcolor = color.new(color.black, tableBgTransparency))
        colIdx += 1
        
        // CUMULATIVE DELTA
        cumDeltaColor = cumulativeDelta >= 0 ? color.rgb(0, 255, 0) : color.rgb(255, 80, 80)
        cumDeltaBg = cumulativeDelta >= 0 ? color.new(color.rgb(0, 100, 0), tableHeaderBgTransparency) : color.new(color.rgb(100, 0, 0), tableHeaderBgTransparency)
        table.cell(tbl, colIdx, 0, 'Cum. Delta', text_color = tableHeaderTextColor, bgcolor = cumDeltaBg, text_size = tSize)
        table.cell(tbl, colIdx, 1, formatVolume(cumulativeDelta), text_color = cumDeltaColor, text_size = tSize, bgcolor = color.new(color.black, tableBgTransparency))
        colIdx += 1
        
        // BUY PRESSURE %
        buyPressureColor = buyPressurePct >= 60 ? color.rgb(0, 255, 0) : buyPressurePct >= 40 ? color.rgb(255, 220, 0) : color.rgb(255, 80, 80)
        buyPressureBg = buyPressurePct >= 60 ? color.new(color.rgb(0, 120, 0), tableHeaderBgTransparency) : buyPressurePct >= 40 ? color.new(color.rgb(160, 80, 0), tableHeaderBgTransparency) : color.new(color.rgb(120, 0, 0), tableHeaderBgTransparency)
        table.cell(tbl, colIdx, 0, 'Buy Press', text_color = tableHeaderTextColor, bgcolor = buyPressureBg, text_size = tSize)
        table.cell(tbl, colIdx, 1, str.tostring(math.round(buyPressurePct)) + '%', text_color = buyPressureColor, text_size = tSize, bgcolor = color.new(color.black, tableBgTransparency))
        colIdx += 1
        
        // SELL PRESSURE %
        sellPressureColor = sellPressurePct >= 60 ? color.rgb(255, 80, 80) : sellPressurePct >= 40 ? color.rgb(255, 220, 0) : color.rgb(0, 255, 0)
        sellPressureBg = sellPressurePct >= 60 ? color.new(color.rgb(120, 0, 0), tableHeaderBgTransparency) : sellPressurePct >= 40 ? color.new(color.rgb(160, 80, 0), tableHeaderBgTransparency) : color.new(color.rgb(0, 120, 0), tableHeaderBgTransparency)
        table.cell(tbl, colIdx, 0, 'Sell Press', text_color = tableHeaderTextColor, bgcolor = sellPressureBg, text_size = tSize)
        table.cell(tbl, colIdx, 1, str.tostring(math.round(sellPressurePct)) + '%', text_color = sellPressureColor, text_size = tSize, bgcolor = color.new(color.black, tableBgTransparency))
        colIdx += 1
        
        // DELTA MOMENTUM
        deltaMomColor = deltaMomentum >= 0 ? color.rgb(0, 255, 0) : color.rgb(255, 80, 80)
        deltaMomBg = deltaMomentum >= 0 ? color.new(color.rgb(0, 100, 0), tableHeaderBgTransparency) : color.new(color.rgb(100, 0, 0), tableHeaderBgTransparency)
        table.cell(tbl, colIdx, 0, 'Δ Mom', text_color = tableHeaderTextColor, bgcolor = deltaMomBg, text_size = tSize)
        table.cell(tbl, colIdx, 1, formatVolume(deltaMomentum), text_color = deltaMomColor, text_size = tSize, bgcolor = color.new(color.black, tableBgTransparency))
        colIdx += 1
        
        // VOLUME MOMENTUM
        volMomColor = volumeMomentum >= 0 ? color.rgb(0, 255, 0) : color.rgb(255, 80, 80)
        volMomBg = volumeMomentum >= 20 ? color.new(color.rgb(0, 120, 0), tableHeaderBgTransparency) : volumeMomentum >= -20 ? color.new(color.rgb(160, 80, 0), tableHeaderBgTransparency) : color.new(color.rgb(120, 0, 0), tableHeaderBgTransparency)
        table.cell(tbl, colIdx, 0, 'Vol Trend', text_color = tableHeaderTextColor, bgcolor = volMomBg, text_size = tSize)
        volMomSign = volumeMomentum >= 0 ? '+' : ''
        table.cell(tbl, colIdx, 1, volMomSign + str.tostring(math.round(volumeMomentum)) + '%', text_color = volMomColor, text_size = tSize, bgcolor = color.new(color.black, tableBgTransparency))
        colIdx += 1
        
        // NET PRESSURE SCORE
        netPressureColor = netPressure >= 30 ? color.rgb(0, 255, 0) : netPressure >= -30 ? color.rgb(255, 220, 0) : color.rgb(255, 80, 80)
        netPressureBg = netPressure >= 30 ? color.new(color.rgb(0, 150, 0), tableHeaderBgTransparency) : netPressure >= -30 ? color.new(color.rgb(160, 80, 0), tableHeaderBgTransparency) : color.new(color.rgb(150, 0, 0), tableHeaderBgTransparency)
        table.cell(tbl, colIdx, 0, 'Net Press', text_color = tableHeaderTextColor, bgcolor = netPressureBg, text_size = tSize)
        netPressureSign = netPressure >= 0 ? '+' : ''
        table.cell(tbl, colIdx, 1, netPressureSign + str.tostring(math.round(netPressure)), text_color = netPressureColor, text_size = tSize, bgcolor = color.new(color.black, tableBgTransparency))
        colIdx += 1
        
        // HIGH CONF COUNT
        highConfRatio = (highConfCount / statsLookback) * 100
        highConfColor = highConfRatio >= 50 ? color.rgb(0, 255, 0) : highConfRatio >= 30 ? color.rgb(255, 220, 0) : color.rgb(255, 80, 80)
        highConfBg = highConfRatio >= 50 ? color.new(color.rgb(0, 120, 0), tableHeaderBgTransparency) : highConfRatio >= 30 ? color.new(color.rgb(160, 80, 0), tableHeaderBgTransparency) : color.new(color.rgb(120, 0, 0), tableHeaderBgTransparency)
        table.cell(tbl, colIdx, 0, 'Hi Conf', text_color = tableHeaderTextColor, bgcolor = highConfBg, text_size = tSize)
        table.cell(tbl, colIdx, 1, str.tostring(highConfCount) + '/' + str.tostring(statsLookback), text_color = highConfColor, text_size = tSize, bgcolor = color.new(color.black, tableBgTransparency))

//================ ALERTAS
alertcondition(showBuySignals and isHighConfBuy, 'HIGH CONFIDENCE BUY', 'BV PRO v2: BUY on {{ticker}} {{interval}}')
alertcondition(showSellSignals and isHighConfSell, 'HIGH CONFIDENCE SELL', 'BV PRO v2: SELL on {{ticker}} {{interval}}')
alertcondition(showDivergences and bearDiv, 'BEARISH DIVERGENCE', 'BV PRO v2: BEAR DIV on {{ticker}} {{interval}}')
alertcondition(showDivergences and bullDiv, 'BULLISH DIVERGENCE', 'BV PRO v2: BULL DIV on {{ticker}} {{interval}}')
alertcondition(showHotVol and isHot, 'HOT VOLUME', 'BV PRO v2: HOT VOL on {{ticker}} {{interval}}')

Overview

The confidence scoring system evaluates candle structure, VWAP coherence, relative volume, and multi-bar consistency. High-confidence buy and sell signals trigger when volume delta meets confidence criteria alongside hot volume or climax conditions. It plots stacked volume bars, volume moving averages, delta lines, and confidence levels in a separate pane, with an optional historical statistics dashboard table.

Details

Published by

bot-trading-project on GitHub

Type

Indicator, Pine Script v6

Draws

Separate pane below the chart

Category

Volume, Screeners & dashboards

Markets

Any symbol

Timeframes

Any timeframe

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
Lookback Periodint20len
Hot Volume Threshold (%)float60hotPct
Minimum Confidence for Signals (%)int70minConfidence
MA TypestringEMAmaType
Stats Lookback Periodint10statsLookback
Show Historical Stats in TablebooltrueshowStats
Use True Range for Climax/ChurnbooltrueuseTR
Use VWAP for Confidence AdjustmentbooltrueuseVWAP
Filter Doji Candles (body <30%)booltruefilterDoji
Consider Multi-Bar ConsistencybooltrueuseMultibar
Show Stacked (Buy Up / Sell Down)booltruestacked
Volume Transparencyint25volTransparency
Show all 40 settings
SettingTypeDefaultVariable
Buy Volume Colorcolorcolor.rgb(0, 255, 0)buyVolColor
Sell Volume Colorcolorcolor.rgb(255, 0, 0)sellVolColor
Show Volume MA LinebooltrueshowVolMA
Volume MA Colorcolorcolor.rgb(255, 215, 0)volMAColor
Volume MA Widthint2volMAWidth
Show Delta LinebooltrueshowDelta
Delta Line Widthint2deltaWidth
Delta Buy Colorcolorcolor.rgb(0, 255, 0)deltaColorBuy
Delta Sell Colorcolorcolor.rgb(255, 0, 0)deltaColorSell
Show Confidence LinebooltrueshowConfLine
Confidence Line Colorcolorcolor.blueconfLineColor
Show HOT VolumebooltrueshowHotVol
Show BUY SignalsbooltrueshowBuySignals
Show SELL SignalsbooltrueshowSellSignals
Show DivergencesboolfalseshowDivergences
HOT Volume Colorcolorcolor.rgb(255, 165, 0)hotVolColor
BUY Signal Colorcolorcolor.rgb(0, 255, 0)buyColor
SELL Signal Colorcolorcolor.rgb(255, 0, 0)sellColor
Bullish Divergence Colorcolorcolor.rgb(0, 200, 0)bullDivColor
Bearish Divergence Colorcolorcolor.rgb(200, 0, 0)bearDivColor
Show Metrics TablebooltrueshowTbl
Table Text SizestringnormaltableSize
Table Background Transparencyint0tableBgTransparency
Table Header Transparencyint20tableHeaderBgTransparency
Table Cell Background Transparencyint60tableCellBgTransparency
Table Header Backgroundcolorcolor.rgb(40, 40, 40)tableHeaderBgColor
Table Header Textcolorcolor.whitetableHeaderTextColor
Table Border Colorcolorcolor.rgb(120, 120, 120)tableBorderColor
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.

Similar Pine Scripts

Oscillator Suite

by TamaraKGreen
46 stars

Oscillator Suite plots a normalised price oscillator in a separate pane and overlays a signal line that can use SMA, EMA, WMA, HMA, RMA, VWMA, T3, ZEMA, KAMA, or GKEMA. It marks bullish and bearish divergences, a smoothed money-flow series, confluence areas an

Indicator v5 Oscillators & momentumDivergence
Updated 7 weeks ago · None stated GitHub repository of Oscillator Suite

Relative Strength Table

by ChartsLector
41 stars

This indicator builds a table of relative strength for up to six user-chosen symbols against a benchmark, defaulting to SPY. It measures strength over four lookback periods, can average the visible periods, and can add relative volume as current volume divided

Indicator v6 Screeners & dashboardsVolume
Updated 2 days ago · None stated GitHub repository of Relative Strength Table

This indicator calculates the Relative Strength Index (RSI) alongside a simple moving average to generate directional momentum signals in a separate pane. It supports Break Flip and Break Continuous scanning modes for long and short setups. A wide array of opt

Indicator v5 Oscillators & momentumVolatility & bands
Updated 1 year ago · None stated GitHub repository of Momentum Setup: RSI Direction Confirmation
11 stars

This indicator plots a smoothed Z-score of cumulative volume delta in a separate pane, showing whether buying or selling pressure is dominant and when the reading enters extreme zones. It marks spot accumulation, climax or exhaustion, and pivot-based price-vol

Indicator v6 Oscillators & momentumVolume Repaints
Updated 7 weeks ago · MIT GitHub repository of CVD Z-Score [NeuNue]

The Candle Pressure Index measures buying versus selling pressure from candle geometry and relative volume. Each bar combines close location, body ratio, and volume rank into a raw pressure value. An exponential moving average of that pressure forms the CPI os

Indicator v6 Oscillators & momentumVolume
Updated yesterday · MIT GitHub repository of Candle Pressure Index [WavesUnchained]

Nexural OrderFlow Matrix

by JasonTeixeira
9 stars

Nexural OrderFlow Matrix is an order flow visualization tool that plots a detailed heatmap table and stacked imbalance bars in a separate pane. It calculates volume metrics using lower timeframe volume delta data, displaying per-candle metrics such as Delta, D

Indicator v6 VolumeScreeners & dashboards
Updated 12 days ago · Custom licence GitHub repository of Nexural OrderFlow Matrix

More indicators

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers