OPEN-SOURCE SCRIPT

Volume Drift Profile [JOAT]

776
Volume Drift Profile [JOAT]

Introduction

Volume Drift Profile is an open-source trend detection indicator that derives directional bias from rolling pivot averages rather than fixed moving averages, and visualizes volume directly on the drift lines themselves as a histogram. The volume histogram coloring adapts to three modes — delta (buy-sell pressure gradient), trend (directional mono-color), and spike-highlighted — making the volume context immediately readable without a separate volume panel.

Most trend indicators separate the price trend line from the volume analysis. The trend line tells you the direction; you look at a separate volume bar panel to interpret whether that direction is supported. Volume Drift Profile overlaps both by rendering volume bars along the drift lines themselves, so the relationship between trend level and volume support is visually immediate.

ảnh chụp nhanh

Core Concepts

1. Pivot Drift Line Calculation

The upper drift line is the rolling average of the most recent N confirmed pivot highs. The lower drift line is the rolling average of the most recent N confirmed pivot lows. This produces smoothed, structurally-anchored reference levels that adapt as new pivots confirm, rather than a fixed-period moving average that treats all bars equally.

Pine Script®
if not na(ph) phArr.push(ph) if phArr.size() > avgCount : phArr.shift() upperDrift := phArr.avg()


Trend flips when price crosses above the upper drift (bull) or below the lower drift (bear).

2. Volume Normalization

Volume is normalized by its 200-bar standard deviation, capped at 4. This z-score-like measure produces a 0-4 scale where 4 represents an extreme volume spike. The step height of each volume bar on the drift line is proportional to this normalized value, so spike bars visually dominate the histogram.

3. Three Volume Coloring Modes

Delta mode computes a buy ratio from (close - low) / (high - low) and maps it through color.from_gradient() between the bear and bull theme colors. Bars with higher closes relative to their range appear in bull color; lower closes in bear color. Volume intensity is further modulated by the normalized volume level.

Trend mode uses a single directional color with intensity modulated by normalized volume.

Spike mode uses trend color normally but switches to a dedicated spike color for bars where normalized volume reaches the extreme level.

4. Absorption Detection

An absorption bar is identified when volume exceeds twice the 20-bar average (high institutional participation) while the body-to-range ratio is below 30% (price closes near where it opened). This pattern suggests large volume without directional price movement — potential institutional accumulation or distribution.

5. Volume-Weighted Momentum

A running Volume-Weighted Momentum reading tracks cumulative signed volume weighted by price change, normalized to a readable scale. This reading reflects directional institutional bias — rising VWM during an uptrend suggests genuine buying pressure supports the move.

ảnh chụp nhanh

Features

  • Pivot drift lines: Upper and lower drift from rolling average of last N confirmed pivot highs and lows
  • Volume histogram on drift lines: Volume bars rendered along the active drift line, sized by normalized volume
  • Three volume coloring modes: Delta (buy-sell gradient), Trend (directional mono), Spikes (trend + spike highlights)
  • Gradient fill between drift and price: Translucent fill between the active drift line and current price
  • Candle volume coloring: Optional bar coloring by volume intensity and trend direction simultaneously
  • Spike detection and highlighting: Bars with extreme normalized volume shown in dedicated spike color
  • Absorption detection: High-volume, small-body bars marked as potential institutional absorption events
  • Volume-Weighted Momentum display: VWM reading normalized and displayed in dashboard
  • Trend flip labels: Clean text labels at trend reversal points with direction indicator
  • Non-repainting: Pivot detection uses standard confirmed pivot functions with symmetric lookback
  • Dashboard: 8-row table with trend direction, volume mode, volume intensity, absorption state, spike state, bars in trend, and VWM


Input Parameters

Drift Structure:
  • Pivot Lookback: Bars required on each side for pivot confirmation (default: 8)
  • Pivot Avg Count: Number of pivots to average for drift line (default: 3)


Volume:
  • Volume Color Mode: Delta / Trend / Spikes
  • Histogram Height: Scale of volume bars on drift line (default: 0.3)
  • Show Volume Histogram toggle
  • Color Price Bars toggle
  • Show Drift Fill toggle
  • Spike Color


Absorption:
  • Show Absorption Dots toggle
  • Absorption Volume Multiple (default: 2.0)
  • Max Body Ratio for absorption detection (default: 0.3)


How to Use This Indicator

Step 1: Read the Drift Line Direction
The active drift line (lower drift in uptrend, upper drift in downtrend) is the primary trend reference. When price is above the lower drift, the trend is bullish. When price crosses the upper drift downward, the trend flips bearish.

Step 2: Interpret Volume Histogram Color
In Delta mode, teal/bull-colored bars represent buying pressure dominating that bar; bear-colored bars represent selling pressure. When large volume bars appear in the trend direction, it confirms the drift.

Step 3: Monitor Absorption Events
Absorption dots mark bars where institutional participants may be accumulating. Large absorption bars at drift line levels are particularly significant — they suggest the drift level is actively defended.

Step 4: Use VWM as Direction Confirmer
Rising VWM during an uptrend means volume-weighted momentum supports price movement. Flat or declining VWM during an uptrend flags weak participation — a potential warning of trend exhaustion.

Indicator Limitations

  • Drift lines require at least N confirmed pivots to begin rendering. In early bars of a new chart, the lines will be absent
  • The volume histogram renders along the drift line. In periods of very high drift line slope, the histogram may visually overlap the price range
  • Absorption detection uses volume relative to a 20-bar average. In low-liquidity environments, the threshold may trigger on routine trading activity
  • The pivot lookback introduces a lag between when a pivot forms and when the drift line updates


Originality Statement

  • Rendering a volume histogram directly along pivot drift lines — rather than in a separate panel — as a real-time visualization that integrates trend level and volume support in a single overlay is an original approach
  • Three independently selectable volume coloring modes driven by a normalized volume z-score, combined with buy-ratio gradient coloring in delta mode, is not replicated in existing open-source pivot drift indicator publications


Disclaimer

This indicator is provided for educational and informational purposes only. It is not financial advice. Trading involves substantial risk of loss. The author accepts no responsibility for trading losses resulting from use of this indicator.

Made with passion by jackofalltrades

Thông báo miễn trừ trách nhiệm

Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.