OPEN-SOURCE SCRIPT
Aktualisiert Volume-Weighted Price Drift

📊 Volume-Weighted Price Drift — Accumulation / Distribution Detector
Ever noticed a stock quietly drifting 3–5% over a few days… on almost no volume? That's not random. Someone is patiently building (or exiting) a position, bar by bar, hoping nobody notices. This indicator measures exactly that.
─────────────────────────────────────────
🔍 WHAT IT DETECTS
─────────────────────────────────────────
The indicator tracks two things simultaneously:
📈 Price drift — How much has price moved directionally over the last N bars?
📦 Volume ratio — How does actual volume compare to its rolling average?
It then calculates a Drift Score:
Drift Score = |price change %| ÷ average volume ratio
A high score means price moved a lot while volume stayed suspiciously low. This is the footprint of patient accumulation (buying quietly) or distribution (selling quietly).
─────────────────────────────────────────
🧠 WHY IT WORKS
─────────────────────────────────────────
On markets with lower liquidity (like many stocks on GPW / Warsaw Stock Exchange), large players can't buy or sell openly without moving the price against themselves. Instead, they:
• Accumulate slowly over days/weeks using small orders
• Shake out weak hands with fake drops on thin volume
• Only let price run once they've built their position
This indicator catches the "quiet drift" phase — the part most people miss because it looks boring on the chart.
─────────────────────────────────────────
📐 HOW IT WORKS
─────────────────────────────────────────
The indicator runs on your current timeframe and shows:
🟩 Green drift score line — accumulation detected (price drifting UP on low volume)
🟥 Red drift score line — distribution detected (price drifting DOWN on low volume)
⚪ Grey drift score line — no signal (normal conditions)
🔵 Blue step-line — average volume ratio over the drift period (below 1.0 = below-normal volume)
Threshold lines:
🔴 Red dashed — strong signal threshold (default: 3.0)
🟠 Orange dotted — moderate signal threshold (default: 1.5)
🔵 Blue dotted — volume ceiling (default: 0.7 = 70% of normal)
⚪ White solid — baseline (1.0 = normal)
When conditions are met, alert labels appear with:
⚠️ Direction (ACCUM or DISTR)
📊 Exact drift %, volume ratio, and drift score
Background shading highlights active signal zones.
─────────────────────────────────────────
⚙️ SETTINGS
─────────────────────────────────────────
Core parameters:
• Drift lookback (bars) — how many bars to measure drift over. Default: 10.
• Volume MA length — rolling average for "normal" volume. Default: 20.
• Drift score smoothing — EMA smoothing. 1 = raw. Default: 3.
Thresholds:
• Max volume ratio for signal — signal only fires when avg volume is BELOW this. Default: 0.7 (70% of normal).
• Min price drift (%) — minimum absolute price change to count. Default: 1.0%.
• Strong signal threshold — drift score above this = strong signal. Default: 3.0.
• Moderate signal threshold — drift score above this = moderate signal. Default: 1.5.
Direction filter:
• Show accumulation — toggle UP-drift signals on/off.
• Show distribution — toggle DOWN-drift signals on/off.
Visual:
• Full color customization for all elements.
• Toggle labels and background shading independently.
• Adjustable background transparency.
Date range:
• Optional date filter to limit detection to a specific period.
─────────────────────────────────────────
✅ RECOMMENDED SETTINGS
─────────────────────────────────────────
For 1h chart (swing trading):
Drift lookback: 10
Volume MA: 20
Max volume ratio: 0.6–0.7
Min drift: 1.0%
Strong threshold: 3.0
Moderate threshold: 1.5
For daily chart (position trading):
Drift lookback: 5–10
Volume MA: 20
Max volume ratio: 0.7
Min drift: 1.5–2.0%
Strong threshold: 3.0
Moderate threshold: 1.5
For 5min chart (intraday):
Drift lookback: 20–30
Volume MA: 50
Max volume ratio: 0.6
Min drift: 0.3%
Strong threshold: 2.0
Moderate threshold: 1.0
─────────────────────────────────────────
💡 PRO TIPS
─────────────────────────────────────────
• Watch for clusters of DISTR followed by ACCUM — this often signals a shakeout-then-accumulate pattern where a large player pushes price down to scare retail, then quietly buys the dip.
• The strongest signals are NOT the ones with the highest drift — they're the ones with the lowest volume ratio. A 2% drift on 0.4x volume is more suspicious than a 5% drift on 0.9x volume.
• Combine with the AutomatOff indicator (ATR + Volume Collapse) — if automats go quiet AND drift score spikes, something is likely brewing.
• On illiquid GPW stocks, lower the volume ratio threshold to 0.5–0.6 for cleaner signals.
─────────────────────────────────────────
⚠️ DISCLAIMER
─────────────────────────────────────────
This indicator is a pattern detection tool, not a trading signal. Low-volume drift can happen for many reasons — always combine with your own analysis and risk management.
─────────────────────────────────────────
🛠️ BUILT WITH PINE SCRIPT v6
─────────────────────────────────────────
Open source. Part of the GPW Anomaly Detection toolkit alongside:
• AutomatOff (ATR + Volume Collapse + Still Price)
• Fixing Volume Visualization
Suggestions and bug reports welcome in the comments.
Ever noticed a stock quietly drifting 3–5% over a few days… on almost no volume? That's not random. Someone is patiently building (or exiting) a position, bar by bar, hoping nobody notices. This indicator measures exactly that.
─────────────────────────────────────────
🔍 WHAT IT DETECTS
─────────────────────────────────────────
The indicator tracks two things simultaneously:
📈 Price drift — How much has price moved directionally over the last N bars?
📦 Volume ratio — How does actual volume compare to its rolling average?
It then calculates a Drift Score:
Drift Score = |price change %| ÷ average volume ratio
A high score means price moved a lot while volume stayed suspiciously low. This is the footprint of patient accumulation (buying quietly) or distribution (selling quietly).
─────────────────────────────────────────
🧠 WHY IT WORKS
─────────────────────────────────────────
On markets with lower liquidity (like many stocks on GPW / Warsaw Stock Exchange), large players can't buy or sell openly without moving the price against themselves. Instead, they:
• Accumulate slowly over days/weeks using small orders
• Shake out weak hands with fake drops on thin volume
• Only let price run once they've built their position
This indicator catches the "quiet drift" phase — the part most people miss because it looks boring on the chart.
─────────────────────────────────────────
📐 HOW IT WORKS
─────────────────────────────────────────
The indicator runs on your current timeframe and shows:
🟩 Green drift score line — accumulation detected (price drifting UP on low volume)
🟥 Red drift score line — distribution detected (price drifting DOWN on low volume)
⚪ Grey drift score line — no signal (normal conditions)
🔵 Blue step-line — average volume ratio over the drift period (below 1.0 = below-normal volume)
Threshold lines:
🔴 Red dashed — strong signal threshold (default: 3.0)
🟠 Orange dotted — moderate signal threshold (default: 1.5)
🔵 Blue dotted — volume ceiling (default: 0.7 = 70% of normal)
⚪ White solid — baseline (1.0 = normal)
When conditions are met, alert labels appear with:
⚠️ Direction (ACCUM or DISTR)
📊 Exact drift %, volume ratio, and drift score
Background shading highlights active signal zones.
─────────────────────────────────────────
⚙️ SETTINGS
─────────────────────────────────────────
Core parameters:
• Drift lookback (bars) — how many bars to measure drift over. Default: 10.
• Volume MA length — rolling average for "normal" volume. Default: 20.
• Drift score smoothing — EMA smoothing. 1 = raw. Default: 3.
Thresholds:
• Max volume ratio for signal — signal only fires when avg volume is BELOW this. Default: 0.7 (70% of normal).
• Min price drift (%) — minimum absolute price change to count. Default: 1.0%.
• Strong signal threshold — drift score above this = strong signal. Default: 3.0.
• Moderate signal threshold — drift score above this = moderate signal. Default: 1.5.
Direction filter:
• Show accumulation — toggle UP-drift signals on/off.
• Show distribution — toggle DOWN-drift signals on/off.
Visual:
• Full color customization for all elements.
• Toggle labels and background shading independently.
• Adjustable background transparency.
Date range:
• Optional date filter to limit detection to a specific period.
─────────────────────────────────────────
✅ RECOMMENDED SETTINGS
─────────────────────────────────────────
For 1h chart (swing trading):
Drift lookback: 10
Volume MA: 20
Max volume ratio: 0.6–0.7
Min drift: 1.0%
Strong threshold: 3.0
Moderate threshold: 1.5
For daily chart (position trading):
Drift lookback: 5–10
Volume MA: 20
Max volume ratio: 0.7
Min drift: 1.5–2.0%
Strong threshold: 3.0
Moderate threshold: 1.5
For 5min chart (intraday):
Drift lookback: 20–30
Volume MA: 50
Max volume ratio: 0.6
Min drift: 0.3%
Strong threshold: 2.0
Moderate threshold: 1.0
─────────────────────────────────────────
💡 PRO TIPS
─────────────────────────────────────────
• Watch for clusters of DISTR followed by ACCUM — this often signals a shakeout-then-accumulate pattern where a large player pushes price down to scare retail, then quietly buys the dip.
• The strongest signals are NOT the ones with the highest drift — they're the ones with the lowest volume ratio. A 2% drift on 0.4x volume is more suspicious than a 5% drift on 0.9x volume.
• Combine with the AutomatOff indicator (ATR + Volume Collapse) — if automats go quiet AND drift score spikes, something is likely brewing.
• On illiquid GPW stocks, lower the volume ratio threshold to 0.5–0.6 for cleaner signals.
─────────────────────────────────────────
⚠️ DISCLAIMER
─────────────────────────────────────────
This indicator is a pattern detection tool, not a trading signal. Low-volume drift can happen for many reasons — always combine with your own analysis and risk management.
─────────────────────────────────────────
🛠️ BUILT WITH PINE SCRIPT v6
─────────────────────────────────────────
Open source. Part of the GPW Anomaly Detection toolkit alongside:
• AutomatOff (ATR + Volume Collapse + Still Price)
• Fixing Volume Visualization
Suggestions and bug reports welcome in the comments.
Versionshinweise
bug fixes and upgradesVersionshinweise
03 VW Drift — changelog do wklejenia w TV:v1.1 — Added HTF Summary Mode (new feature) with two new alert conditions: "HTF — Accumulation Detected" and "HTF — Distribution Detected". Previously no HTF support. Scan daily bars from a weekly chart, or hourly bars from a daily chart. Auto-detects based on chart timeframe — no manual toggle needed.
Versionshinweise
v1.1 — Added HTF Summary Mode (new feature) with two new alert conditions: "HTF — Accumulation Detected" and "HTF — Distribution Detected". Previously no HTF support. Scan daily bars from a weekly chart, or hourly bars from a daily chart. Auto-detects based on chart timeframe — no manual toggle needed.Versionshinweise
v1.1 — Reduce signal noiseNew toggle: "Only show STRONG signals" in the Signal Strength Filter group. Enable it to hide the MODERATE tier entirely — labels and background only render for STRONG signals (score ≥ Strong threshold).
In HTF Summary Mode this also overrides "Min severity to highlight" to STRONG. Off by default — existing charts unaffected until enabled.
Versionshinweise
v1.1-1.2 — Signal filtering + gradient background
New toggle: "Only show STRONG signals" — hides the MODERATE tier entirely (labels + background), showing only STRONG accumulation/distribution. Also applies to HTF Summary Mode.
New: background darkness now scales with the drift score instead of a single fixed transparency — higher score = darker background, readable even without labels. New toggle "Scale background darkness with score" lets you turn this off and revert to the old fixed-transparency look.
All new settings off/on by sensible defaults — existing charts unaffected until changed.
Versionshinweise
v1.1-1.4 — Signal filtering + gradient backgroundNew toggle: "Only show STRONG signals" — hides the MODERATE tier entirely (labels + background), showing only STRONG accumulation/distribution. Also applies to HTF Summary Mode.
New: background darkness now scales with the drift score instead of a single fixed transparency — higher score = darker background, readable even without labels. Controlled by "Scale background darkness with score", "Background darkness cap (x Strong threshold)" (default 5.0), and "Background contrast boost" (default 1.0 — linear gradient, tuned for maximum visible differentiation between score levels).
All new settings off/on by sensible defaults — existing charts unaffected until changed.
Open-source Skript
Ganz im Sinne von TradingView hat dieser Autor sein/ihr Script als Open-Source veröffentlicht. Auf diese Weise können nun auch andere Trader das Script rezensieren und die Funktionalität überprüfen. Vielen Dank an den Autor! Sie können das Script kostenlos verwenden, aber eine Wiederveröffentlichung des Codes unterliegt unseren Hausregeln.
Haftungsausschluss
Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.
Open-source Skript
Ganz im Sinne von TradingView hat dieser Autor sein/ihr Script als Open-Source veröffentlicht. Auf diese Weise können nun auch andere Trader das Script rezensieren und die Funktionalität überprüfen. Vielen Dank an den Autor! Sie können das Script kostenlos verwenden, aber eine Wiederveröffentlichung des Codes unterliegt unseren Hausregeln.
Haftungsausschluss
Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.