OPEN-SOURCE SCRIPT

PVSRA Volume Trend

67
The PVSRA Volume Trend indicator combines PVSRA (Price Volume Spread Range Analysis) volume classification with a dual-MA volume trend system. Each bar is classified into tiers by its relative volume, while two smoothed moving averages (fast and slow) applied to volume reveal whether overall market participation is increasing or declining — similar to how dual-MA crossover systems work on price, but applied to volume.

When the volume trend is enabled, normal (non-vector) bars adopt a lightened shade of the current trend direction color, so even bars with unremarkable volume communicate whether participation is rising or falling. This integration of PVSRA classification with volume trend direction in a single indicator provides both spike detection and trend context without requiring a separate trend tool.


USAGE

Volume Classification (PVSRA)
Each bar is classified into one of four categories based on how its volume compares to the rolling average:
Extreme (Climax): Volume exceeds 500% of the average. These bars often indicate institutional activity or significant market events. Colored distinctly (default: yellow) for immediate visibility.
Peak (Above Average): Volume exceeds 200% of the average, OR the product of candle spread × volume is the highest in the lookback period. Notable activity that may signal the beginning of a larger move.
Rising: Volume exceeds 150% of the average. Above-normal activity worth monitoring.
Normal: Volume within the expected range. When Volume Trend is enabled, normal bars are colored with a lightened version of the current trend color (bull or bear). When disabled, they use a neutral gray.

Volume Trend (Dual MA)
Two moving averages are calculated on volume: a fast SMMA (default: 50 periods) and a slow SMMA (default: 100 periods), each smoothed with an additional EMA(10) pass. When the fast MA is above the slow MA, volume is trending up — market participation and interest are increasing. When below, volume is trending down. A colored ribbon fill between the two lines makes the trend direction immediately visible.

The volume trend provides context that PVSRA classification alone does not: a 200% volume spike during an overall rising volume trend has different implications than the same spike during declining participation. By displaying both layers simultaneously, the indicator answers two questions at once — "Is this bar significant?" (PVSRA classification) and "Is overall participation increasing or decreasing?" (volume trend).

Volume Moving Average
An optional single moving average line (default: 20 periods) can be displayed as a reference level. This provides a simple visual baseline for judging whether current volume is above or below its recent average.

Candle Coloring
When enabled, chart candles are colored according to their volume classification tier. Vector candles (150%+) use their tier color regardless of trend. Normal candles adopt the lightened trend color when Volume Trend is active, providing directional context on every bar.

Binance PERP Volume Override
For crypto symbols, the indicator can automatically pull volume data from the Binance perpetual contract instead of the current chart's exchange. This is useful when analyzing spot charts but wanting the more active futures volume data, or for normalizing volume across exchanges. If the Binance perp ticker is unavailable, it falls back to the chart's native volume data automatically.

Alerts
Built-in alert conditions include:
• Volume Trend direction changes (turned up / turned down)
• Any vector candle (150%+)
• Tier-specific alerts: Extreme (500%), Peak (200%), Rising (150%)
• Directional tier alerts: Bullish or bearish variants for each tier


DETAILS

PVSRA Classification
Volume is compared against a Simple Moving Average over the configurable lookback period (default: 20 bars). The ratio of current volume to average volume determines the tier. The Peak (200%) tier has a dual condition: it triggers either when volume exceeds 200% of the average OR when the product of candle spread (high − low) × volume exceeds the highest such product in the lookback period. This spread×volume condition captures high-impact bars where a wide spread consumed significant volume, even if raw volume alone didn't reach 200%.

Volume Trend Calculation
Each MA uses a two-stage smoothing pipeline:
1 — A Smoothed Moving Average (SMMA) is calculated recursively: SMMA = (prev_SMMA × (length − 1) + source) / length
2 — An EMA with a fixed period of 10 is applied to the SMMA output
This SMMA+EMA combination produces a smoother line than either method alone, reducing whipsaws in the trend signal while remaining responsive to genuine shifts in volume participation.

The fast MA (default: 50) responds more quickly to volume changes; the slow MA (default: 100) establishes the baseline. The crossover determines trend direction.

Trend-Integrated Normal Bar Coloring
When Volume Trend is enabled, normal (non-vector) volume bars use a lightened version of the current trend color. The lightening is computed by blending each RGB channel 60% toward white: lightened_channel = channel + (255 − channel) × 0.6. This produces a pastel variant that is visually distinct from vector candle colors while still communicating the prevailing volume direction.

Binance PERP Override
The perpetual ticker is constructed as "BINANCE:" + basecurrency + quotecurrency + ".P". Volume, high, low, close, and open are all fetched from this ticker via request.security(). If the security call returns na (ticker unavailable), all values fall back to the chart's native data, ensuring the indicator never displays blank output.


SETTINGS

Instrument Override
Use Binance PERP Volume: Automatically fetch volume from the equivalent Binance perpetual contract (crypto only).
Force Override Symbol: Manually specify any ticker for volume data.

Candle Colours
Set PVSRA candle colours on chart: Color chart candles by volume tier.
500% / 200% / 150% / Normal Colors: Customizable bull and bear colors for each tier.

Volume Moving Average
Show Volume MA: Toggle the single MA reference line.
MA Length: Period for the volume moving average (default: 20).
MA Color / Line Width: Visual customization.

Volume Trend
Show Volume Trend: Toggle the dual-MA trend system and ribbon fill.
Fast MA Length: Period for the fast SMMA (default: 50).
Slow MA Length: Period for the slow SMMA (default: 100).
Bull / Bear Color: Colors for the trend lines and ribbon fill.
Fill Transparency: Controls the opacity of the ribbon fill between the two MAs (default: 50).


METHODOLOGY

PVSRA is a known volume classification approach. The source code is protected because it contains the specific implementation of: (1) The tiered classification logic with the dual-condition Peak tier (200% volume OR highest spread×volume in the lookback). (2) The volume trend dual-MA system using a two-stage SMMA→EMA(10) pipeline on both fast and slow MAs with ribbon fill and crossover-based trend determination. (3) The trend-integrated normal bar coloring that blends each RGB channel 60% toward white to produce pastel variants of the current trend color for non-vector bars. (4) The Binance PERP volume override with programmatic ticker construction and automatic fallback. (5) The comprehensive alert system covering trend direction changes and all tier/direction combinations.


This indicator measures relative volume and volume trend direction. It does not predict price direction. Volume classification thresholds are fixed and may not suit all market conditions. It does not constitute financial advice.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.