업데이트됨

VWAP Deviation Divergence Oscillator

897
VWAP Deviation Divergence Oscillator

## Overview

The VWAP Deviation Divergence Oscillator turns the **deviation of price from its session-anchored Volume-Weighted Average Price (VWAP)** into a standardized, bounded oscillator, and then looks for **divergence between price and that deviation**. The idea it tests: when price makes a new extreme but sits less far from VWAP than before, the volume-weighted average is no longer confirming the move.

It is a single-pane oscillator. It requires real traded volume (use a futures contract; cash indices report none, in which case the dashboard shows "no volume"). Every data input is user-configurable, so it runs on any symbol that reports volume, in any market and on any timeframe. Defaults target NSE NIFTY index futures on intraday charts.

## What it plots

- A z-scored **VWAP deviation oscillator** (stretched above VWAP = up, stretched below = down), with a glow line and sigma-based overbought/oversold levels.
- **Extreme-zone bands** (default +/-3 sigma) with a gradient fill that deepens toward the edge.
- **Divergence lines and labels** on the oscillator - regular (reversal) and hidden (continuation), in two colors.
- **In-band reversal dots** where the oscillator turns inside an extreme zone.
- Optional **price-pane marks** at the confirmation bar (all generated by this one indicator).
- A **background-adaptive status dashboard** (oscillator value in sigma, zone, last divergence, last reversal, live distance to VWAP).

## Why these components are combined (mashup rationale)

This script combines a **derived measure**, a **normalization stage**, a **divergence engine** and a **reversal read**, because each answers a question the others cannot and none is useful here alone:

1. **VWAP deviation (price + volume).** VWAP is the volume-weighted "fair value" the session has actually transacted at - it blends price and traded volume, which a price-only oscillator does not. How far price sits from VWAP, in standardized terms, is a mean-reversion read: the deviation = price - session VWAP.

2. **Standardization (rolling z-score).** VWAP deviation differs in scale across instruments. The z-score expresses it in standard-deviation units, so "overbought/oversold" and the extreme bands mean the same thing on NIFTY, on a commodity future, or on a crypto instrument. Without this step the divergence thresholds would not transfer between symbols.

3. **Divergence engine.** The original payload is reading **price-versus-VWAP deviation disagreement at confirmed pivots**. The engine pairs each new price pivot with the oscillator value, then requires: a genuine new price extreme; the measure failing to confirm it; a minimum oscillator gap scaled to the oscillator own stdev; the two pivots within a maximum bar distance; and optionally an overbought/oversold reading at the pivot. These gates make the combination produce signal rather than noise.

4. **Reversal read.** Independently, the engine flags oscillator turns that occur inside the extreme bands - a complementary exhaustion cue.

Together the components form one pipeline: **build the signal -> make it comparable (z-score) -> surface where price and that signal disagree (divergence) and where it exhausts (reversal).** Each is incomplete alone.

## How it works (method)

deviation = price - session-anchored VWAP (which resets each session and requires real volume); this is standardized with a rolling z-score to the oscillator.

Regular and hidden divergence are detected from confirmed pivothigh/pivotlow pivots and filtered by the gates above; reversals are oscillator pivots that print inside the extreme bands. Pivots confirm a few bars after they occur, so a printed signal does not repaint. The confirmation lag equals the pivot length.

## How to use it

1. Add the indicator on a volume-bearing instrument (a futures contract); on a cash index it will read "no volume".
2. Read divergence as **context, not a trigger**: a bearish divergence (price higher high, deviation lower high) says price is less extended above VWAP than at the prior high; a bullish divergence says the opposite at lows. Confirm with your own structure, levels and risk process.
3. Tune the **pivot length**, **max gap** and **min oscillator gap** to your timeframe; raise them for fewer, cleaner signals.

## Originality

This is an original implementation - not a VWAP deviation line and not a generic divergence script, but the specific combination of VWAP deviation, sigma-standardization that makes the read portable across markets, a multi-gate divergence engine (magnitude + distance + extreme-zone), hidden-divergence and in-band reversal detection, and a background-adaptive dashboard. The code is written from scratch; helper functions use only their arguments and built-ins.

## Credits

The **Volume-Weighted Average Price (VWAP)** and **price/oscillator divergence** are standard, publicly documented techniques. This script is not affiliated with, nor endorsed by, any third party.

## Notes / limitations

- VWAP deviation needs real volume and is session-relative; it resets each session and is undefined without a volume feed.
- Divergence is descriptive context, never a guarantee of reversal.
- Confirmation lags each pivot by the pivot length.

## Disclaimer

Research and educational tool only. NOT financial advice and no guarantee of profitability or accuracy. Indicators describe past behaviour; they do not predict the future. Trading carries risk of loss. Test out-of-sample and make your own decisions. The author accepts no liability for any use of this script.

릴리즈 노트
VWAP Deviation Divergence Oscillator — update notes

Forward calibration added. Each divergence and reversal class (Reg Bull/Bear, Hidden Bull/Bear, Rev +/−) is resolved by a triple-barrier outcome, uniqueness-weighted and recency-decayed, reported as an edge over a zone-matched base rate with a Wilson interval and a multiple-testing-corrected significance star — so you can see which VWAP-deviation divergences actually pay.

Configurable volume (any market). A volume-source input plus a borrow symbol and a manual session VWAP that honours them let the oscillator run on instruments that report no native volume.
Identity strip showing name · symbol · timeframe on the chart (theme-adaptive).
Exports bus: EXP_Osc, EXP_OscZ, EXP_Zone, EXP_Bias, EXP_RegDiv, EXP_HidDiv, EXP_Reversal, EXP_BullEdge, EXP_BearEdge, plus EXP_VWAPDist and EXP_DataLive.

Pro dashboard adds the per-class calibration table; settings reorganized into 7 groups; all toggles default-on; NIFTY/intraday defaults retained; VWAP credit kept in the header, out of the UI.

Educational only — not financial advice. VWAP deviation needs real volume and is session-relative; calibration is in-sample, forward-measured. Validate out-of-sample.
릴리즈 노트
v1.1 — Four additive layers: robust normalization, a lag-minimal smoother, a 3-window extreme consensus, and a walk-forward out-of-sample reliability read. The session-anchored VWAP, the deviation engine, the divergence engine and the triple-barrier zone-matched calibration are unchanged — set Normalization = "Classic (mean/stdev)" and Smoother = "EMA" for the original read.

1. Robust MAD normalization (default on). The VWAP deviation can be standardized with a median/MAD z-score (median absolute deviation ×1.4826) instead of mean/stdev. Deviation spikes on opening drives, news and stop-runs; MAD ignores those outliers so the sigma bands and OB/OS zones keep a stable meaning. Selectable via "Normalization".

2. UltimateSmoother (default on). When oscillator smoothing is on, it can use Ehlers' lag-minimal UltimateSmoother instead of an EMA. Selectable via "Smoother".

3. 3-window extreme consensus (opt-in, default off). z as the MEDIAN of the z at half, one and double the normalization window — extreme only when short/medium/long agree.

4. Walk-forward out-of-sample reliability. The first N resolved signals TRAIN; every one after is scored OUT-OF-SAMPLE and exported as EXP_OOSEdge / EXP_OOSHit — the trustworthy read.

What is unchanged. The session-anchored VWAP with its per-session reset and optional volume-borrow, the price-minus-VWAP deviation, the standardization, the regular + hidden divergence engine, the in-band reversal read and the entire triple-barrier zone-matched calibration (uniqueness-weighting, recency decay, Wilson interval, Šidák correction) are byte-for-byte the published version. The new layers only read existing series.

Still research/education only — NOT financial advice; VWAP needs real volume (use a futures contract, or the borrow-symbol input). Non-repaint: late-confirming pivots, calibration resolves on confirmed bars. Concept credits unchanged (VWAP standard method; López de Prado triple-barrier/uniqueness; Wilson; Šidák; Ehlers UltimateSmoother).
릴리즈 노트
v1.2 — R1 honest-stats standardization. Robust-z and the Wilson confidence half-width now come from the published calibration libraries (ml_robuststats/2, ml_calib/2), byte-identical to the prior local helpers — oscillator, divergence detection, marks and calibration numbers unchanged. Shared calibration engine across the divergence family.

면책사항

해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.