Indicator · Pine Script v6 · Own pane

PVSR Volume MP

by midngtpickle· code credited to midnight pickle

PVSR Volume MP calculates and displays volume bars categorized using Price Volume Spread Analysis in a separate indicator pane.

View on GitHub

GitHub stars2on the repository
Pine versionv6current
Lines of code117
Settings18inputs
LicenceCustom licencefile: MPL-2.0
Last update4 weeks ago27 Sep 2026

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

117 lines of Pine Script v6 from individual_scripts/pvsr_volume_.pine, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.

pvsr_volume_.pine
// This Pine Script® code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © midnight pickle
//
// ============================================================================
//  PVSR Volume MP
//  Volume columns coloured by PVSRA classification, volume MA, threshold lines.
//  Lives in its own pane.
//
//  Split out of "EMA & PVSR Master". Classification logic unchanged.
//
//  ⚠️ SHARED CLASSIFICATION: PVSR Candles, PVSR Volume and PVSR Vector Zones
//  each carry their own copy of the classification inputs and maths. They only
//  agree with each other if the inputs are set identically in all three. If a
//  volume bar's colour disagrees with its candle's colour, a setting has
//  drifted between the two scripts.
// ============================================================================

//@version=6
indicator("PVSR Volume MP", shorttitle="PVSR Volume MP", overlay=false)

// ==========================================
// 🔹 MASTER TOGGLE
// ==========================================

master_show_volume = input.bool(true, title="🔘 MASTER: Show Volume Panel", group="⚡ MASTER TOGGLES", tooltip="Master toggle for the volume columns / MA / threshold lines in this pane")

// --- Volume Panel Settings ---
show_volume_ma   = input.bool(true, title="Show Volume Moving Average", group="📊 Volume Panel")
volume_ma_length = input.int(20, title="Volume MA Length", minval=5, maxval=200, group="📊 Volume Panel")
col_volume_ma    = input.color(color.blue, title="Volume MA Color", group="📊 Volume Panel")
show_thresholds  = input.bool(true, title="Show Threshold Lines", group="📊 Volume Panel")
col_aboveavg     = input.color(color.new(color.yellow, 50), title="Above-Average Threshold", group="📊 Volume Panel")
col_climax       = input.color(color.new(color.red, 50),    title="Climax Threshold",        group="📊 Volume Panel")

// ==========================================
// 🔹 PVSR CLASSIFICATION INPUTS
// ==========================================
// ⚠️ SHARED SETTINGS. These must be set identically in PVSR Candles, PVSR
// Volume and PVSR Vector Zones, or the three will classify the same bar
// differently and their colours will disagree on the chart.

// Classification thresholds
climax_mult   = input.float(2.0, title="Climax Volume ×",       minval=1.0, step=0.1, group="🕯️ PVSR Classification (must match across PVSR scripts)", tooltip="Volume ≥ this × average, or a volume-spread high, marks a climax (green/red) candle.")
aboveavg_mult = input.float(1.5, title="Above-Average Volume ×", minval=1.0, step=0.1, group="🕯️ PVSR Classification (must match across PVSR scripts)", tooltip="Volume ≥ this × average marks an above-average (blue/violet) candle.")
vol_lookback  = input.int(10,    title="Volume Lookback (bars)", minval=1,            group="🕯️ PVSR Classification (must match across PVSR scripts)", tooltip="Bars used for the average volume and volume-spread high.")

// How the lookback window is measured, and which climax test is active.
pvsr_exclude_current = input.bool(true, title="Exclude current bar from lookback", group="🕯️ PVSR Classification (must match across PVSR scripts)", tooltip="ON (canonical): the average volume and the volume-spread high are measured over the PREVIOUS N bars, matching the original PVSRA definition. OFF: the current bar sits inside its own comparison window, so an outsized bar raises the very threshold it is being tested against and can suppress its own signal. Turn OFF to reproduce charts drawn before this option existed.")
pvsr_use_spread_leg  = input.bool(true, title="Use volume × spread climax leg",  group="🕯️ PVSR Classification (must match across PVSR scripts)", tooltip="A bar is climax if volume ≥ climax × average OR volume × range is the highest of the lookback. That second leg fires whenever a bar sets a new lookback high in volume × range, which happens roughly once every N bars regardless of conditions, so it triggers far more often than the volume leg. Turn OFF to see classification driven by volume alone.")

// PVSR Color Settings (shared)
red_vector_color        = input.color(color.rgb(255, 82, 82),   title="Red Vector Candle",   group="🎨 PVSR Color Settings", inline="pvsrc")
green_vector_color      = input.color(color.rgb(76, 175, 80),   title="Green Vector Candle", group="🎨 PVSR Color Settings", inline="pvsrc")
violet_vector_color     = input.color(color.rgb(156, 39, 176),  title="Violet Vector Candle", group="🎨 PVSR Color Settings", inline="pvsrc")
blue_vector_color       = input.color(color.rgb(33, 150, 243),  title="Blue Vector Candle",  group="🎨 PVSR Color Settings", inline="pvsrc")
dark_grey_candle_color  = input.color(color.rgb(100, 100, 100), title="Regular Down Candle", group="🎨 PVSR Color Settings", inline="pvsrc")
light_gray_candle_color = input.color(color.rgb(169, 169, 169), title="Regular Up Candle",   group="🎨 PVSR Color Settings", inline="pvsrc")
// ==========================================
// 🔹 PVSR CLASSIFICATION
// ==========================================
// ⚠️ This block is duplicated byte-for-byte across PVSR Candles, PVSR Volume
// and PVSR Vector Zones. The three scripts only agree if the inputs above are
// set identically in all of them. If candle colours and volume-bar colours
// ever disagree, the cause is a drifted input, not a bug in the maths.

bool  hasVolume    = not na(volume)
float volumeSpread = volume * (high - low)

// Canonical PVSRA measures both comparisons over the PREVIOUS vol_lookback
// bars. With the current bar inside its own window, a large bar drags its own
// average up and can fail the very test it should pass, and the spread test
// degenerates into "is this bar the highest of the last N including itself".
// The [1] offset excludes the current bar from both.
float averageVolume    = pvsr_exclude_current ? ta.sma(volume, vol_lookback)[1]            : ta.sma(volume, vol_lookback)
float highestVolSpread = pvsr_exclude_current ? ta.highest(volumeSpread, vol_lookback)[1]  : ta.highest(volumeSpread, vol_lookback)

// Split out so each climax leg can be toggled and read independently. The
// spread leg fires roughly once every vol_lookback bars by construction, so it
// dominates the volume leg unless it is switched off.
bool climaxByVolume = hasVolume and not na(averageVolume)    and volume      >= climax_mult * averageVolume
bool climaxBySpread = hasVolume and not na(highestVolSpread) and pvsr_use_spread_leg and volumeSpread >= highestVolSpread
bool aboveAverage   = hasVolume and not na(averageVolume)    and volume      >= aboveavg_mult * averageVolume

color pvsraColor  = na
int   pvsraCode   = na
bool  vectorAlert = false

if climaxByVolume or climaxBySpread
    // Climax
    pvsraColor := close > open ? green_vector_color : red_vector_color
    pvsraCode  := close > open ? 3 : -3
    vectorAlert := true
else if aboveAverage
    // Above average
    pvsraColor := close > open ? blue_vector_color : violet_vector_color
    pvsraCode  := close > open ? 2 : -2
    vectorAlert := true
else
    // Regular (also the fallback when volume is unavailable, and on the first
    // vol_lookback bars where the shifted average is not yet defined)
    pvsraColor := close > open ? light_gray_candle_color : dark_grey_candle_color
    pvsraCode  := close > open ? 1 : -1
    vectorAlert := false

// Volume panel derived series
float volume_ma = ta.sma(volume, volume_ma_length)
float avgAbove  = averageVolume * aboveavg_mult
float avgClimax = averageVolume * climax_mult

// ==========================================
// 🔹 PLOTTING - VOLUME PANE
// ==========================================

plot(master_show_volume ? volume : na, title="PVSR Volume", color=pvsraColor, style=plot.style_columns, linewidth=2)
plot(master_show_volume and show_volume_ma  ? volume_ma : na, title="Volume MA",           color=col_volume_ma, linewidth=2)
plot(master_show_volume and show_thresholds ? avgAbove  : na, title="Above-Avg Threshold", color=col_aboveavg,  linewidth=1)
plot(master_show_volume and show_thresholds ? avgClimax : na, title="Climax Threshold",    color=col_climax,    linewidth=1)

Overview

PVSR Volume MP highlights climax volume, above-average volume, and regular volume based on configurable lookback windows and multipliers. The script plots a volume moving average line alongside threshold levels for visual reference. Key settings allow users to adjust lookback periods, multiplier thresholds, volume MA lengths, and color themes.

Details

Published by

midngtpickle on GitHub

Code credit

midnight pickle, as written in the script's header

Draws

Separate pane below the chart

Category

Volume

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
🔘 MASTER: Show Volume Panelbooltruemaster_show_volume
Show Volume Moving Averagebooltrueshow_volume_ma
Volume MA Lengthint20volume_ma_length
Volume MA Colorcolorcolor.bluecol_volume_ma
Show Threshold Linesbooltrueshow_thresholds
Above-Average Thresholdcolorcolor.new(color.yellow, 50)col_aboveavg
Climax Thresholdcolorcolor.new(color.red, 50)col_climax
Climax Volume ×float2.0climax_mult
Above-Average Volume ×float1.5aboveavg_mult
Volume Lookback (bars)int10vol_lookback
Exclude current bar from lookbackbooltruepvsr_exclude_current
Use volume × spread climax legbooltruepvsr_use_spread_leg
Show all 18 settings
SettingTypeDefaultVariable
Red Vector Candlecolorcolor.rgb(255, 82, 82)red_vector_color
Green Vector Candlecolorcolor.rgb(76, 175, 80)green_vector_color
Violet Vector Candlecolorcolor.rgb(156, 39, 176)violet_vector_color
Blue Vector Candlecolorcolor.rgb(33, 150, 243)blue_vector_color
Regular Down Candlecolorcolor.rgb(100, 100, 100)dark_grey_candle_color
Regular Up Candlecolorcolor.rgb(169, 169, 169)light_gray_candle_color
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

Money Flow Index

by everget
947 stars

Calculates the standard Money Flow Index (MFI) oscillator alongside an exponential moving average signal line in a separate pane. The script visually highlights trend conditions through dynamic ribbon filling, optional difference histogram bars, and overbought

Indicator v4 Oscillators & momentumVolume
Updated 12 days ago · GPL-3.0 GitHub repository of Money Flow Index

This indicator plots a Supertrend-based trend-following setup in a separate pane and skips conditions it treats as a sideways market. A volatility range is built from an ATR value, with RMA, SMA, EMA, or WMA smoothing, or from a fixed point distance. Optional

Indicator v5 TrendVolatility & bands
Updated 1 year ago · MPL-2.0 GitHub repository of Trend Following Setup - Sideways Market Skipper
550 stars

Range Volume Change compares volume inside a chosen session window with the same window on the previous day and plots that change as a percentage. It accumulates volume during the window and, when enabled, volume outside it, drawing growing columns in a separa

Indicator v5 VolumeSessions & time Repaints
Updated 10 months ago · None stated GitHub repository of Range Volume Change
257 stars

This indicator builds a footprint of estimated buy and sell volume across price rows and plots it in a separate pane. It fills rows from bar low to high, stores volume per row, and draws buy and sell volume boxes, volume-profile boxes, row labels, and cumulati

Indicator v5 Volume Repaints
Updated 7 weeks ago · None stated GitHub repository of Footprint Delta Lite

Commitment Gauge

by harryguiacorn
220 stars

This indicator measures directional momentum by evaluating candlestick body proportions and volume over a user-defined lookback window. It computes the ratio of candle body to total range, weights the cumulative value by volume and absolute body size, and dete

Indicator v4 VolumeCandlestick patterns
Updated 1 year ago · None stated GitHub repository of Commitment Gauge

Aggregate Signal

by capissimo
114 stars

This indicator builds an aggregate oscillator in a separate pane. It scales open, high, low, close, and volume into a 0 to 1 range, then averages scaled readings from MACD, a MACD histogram, RSI, stochastic, CCI, momentum, OBV, a directional index, volume-weig

Indicator v4 Oscillators & momentumVolume Repaints
Updated 1 year ago · None stated GitHub repository of Aggregate Signal

More Volume scripts

Related on ForexR

Trade Your Charts With a Regulated Broker

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

Compare brokers