//@version=6
// ============================================================================
// CVD Bias [WavesUnchained]
// Version: 1.1.5
// Author: WavesUnchained
// Build: 2026-10-12
// ============================================================================
// Estimates a price-weighted volume balance over a rolling window. This is
// NOT real Cumulative Volume Delta — OHLCV data carries no aggressor-side
// trade classification, so "buying" and "selling" volume are inferred only
// from where price closed within the bar's range, never from actual trade
// direction. Real Delta/CVD requires request.footprint() (out of scope
// here). Within that heuristic, the per-bar signed-volume proxy is
// accumulated as a running total rather than smoothed into an EMA, showing
// whether the price-weighted balance has been persistently skewed bullish or
// bearish and whether that skew is building or fading.
//
// Features:
// ✓ Per-bar signed-volume proxy: (2 × close_location − 1) × volume (heuristic, not real CVD)
// ✓ Rolling sum: accumulated over configurable window, normalized to −1..+1
// ✓ Rate of change: acceleration of the volume-balance proxy
// ✓ Price/proxy divergence: price new N-bar extreme while proxy rate opposes
// ✓ Dashboard: proxy level, rate, divergence state
// ✓ Alerts: bull/bear divergence, zero cross
//
// Data Contract:
// Price: REQUIRED chart symbol
// Volume: REQUIRED real trade volume — feed must deliver volume and
// syminfo.volumetype must not be "tick"; otherwise not available
// OI: NO
// Reference: NO
// Verdict: Exchange-only
// ============================================================================
indicator("CVD Bias [WavesUnchained]", "CVD [WU]", format=format.price, precision=2, overlay=false)
// ─── Inputs ───────────────────────────────────────────────────────────────────
grCVD = "CVD Settings"
cvdLen = input.int(50, "Accumulation Window", minval=10, maxval=500, group=grCVD,
tooltip="Bars over which the signed-volume proxy is summed. Longer = smoother, slower to react.")
normLen = input.int(200, "Normalization Lookback", minval=20, maxval=1000, group=grCVD,
tooltip="Lookback for finding recent CVD amplitude. Used to keep the oscillator on a −1..+1 scale.")
rocLen = input.int(5, "Rate of Change Length", minval=1, maxval=30, group=grCVD)
grDiv = "Divergence"
enableDiv = input.bool(true, "Detect Price/CVD Divergences", group=grDiv)
pivLeft = input.int(5, "Swing Left Bars", minval=1, group=grDiv)
pivRight = input.int(5, "Swing Right Bars", minval=1, group=grDiv,
tooltip="Lookback period for confirming a pivot high or low. Larger values reduce noise but increase signal delay.")
grD = "Display"
showDash = input.bool(true, "Show Dashboard", group=grD)
// Echtes Handelsvolumen? Nur "tick" schließt es ausdrücklich aus (Anzahl
// Transaktionen, keine Menge). "n/a" heißt laut Referenz "kein Volumen ODER Art
// nicht angegeben" — die meisten Feeds außer Krypto melden das, auch Futures mit
// echten Kontrakten. Dort entscheidet, ob der Feed überhaupt Volumen liefert.
var bool feedHasVolume = false
if nz(volume) > 0
feedHasVolume := true
bool volumeIsReal = syminfo.volumetype != "tick" and feedHasVolume
float vol = volumeIsReal ? volume : na
// ─── Per-bar signed-volume proxy ──────────────────────────────────────────────
// closeLoc = 0: closed at low (full bear bar), 1: closed at high (full bull bar)
// signedVolumeProxy: price-location-weighted volume — a heuristic, NOT real
// trade delta. OHLCV has no aggressor-side classification.
hl = high - low
closeLoc = hl > 0 ? (close - low) / hl : 0.5
signedVolumeProxy = (2.0 * closeLoc - 1.0) * vol
// ─── Rolling CVD + normalization ─────────────────────────────────────────────
cvdRaw = math.sum(signedVolumeProxy, cvdLen)
cvdAmp = ta.highest(math.abs(cvdRaw), normLen)
cvdNorm = not volumeIsReal ? na : cvdAmp > 0 ? cvdRaw / cvdAmp : 0.0
// Rate of change: how fast is the balance shifting
cvdRoc = cvdNorm - nz(cvdNorm[rocLen])
// ─── Divergence: structural swing-pivot divergence ───────────────────────────
ph = ta.pivothigh(high, pivLeft, pivRight)
pl = ta.pivotlow(low, pivLeft, pivRight)
prevPh = ta.valuewhen(not na(ph), high[pivRight], 1)
prevPl = ta.valuewhen(not na(pl), low[pivRight], 1)
prevCvdAtPh = ta.valuewhen(not na(ph), cvdNorm[pivRight], 1)
prevCvdAtPl = ta.valuewhen(not na(pl), cvdNorm[pivRight], 1)
bearDivRaw = not na(ph) and not na(prevPh) and high[pivRight] > prevPh and cvdNorm[pivRight] < prevCvdAtPh
bullDivRaw = not na(pl) and not na(prevPl) and low[pivRight] < prevPl and cvdNorm[pivRight] > prevCvdAtPl
bearDiv = enableDiv and bearDivRaw
bullDiv = enableDiv and bullDivRaw
// ─── Colors ───────────────────────────────────────────────────────────────────
bullC = color.new(#00c853, 0)
bearC = color.new(#d50000, 0)
neutC = color.new(color.gray, 30)
cvdColor = cvdNorm > 0.2 ? bullC : cvdNorm < -0.2 ? bearC : neutC
rocColor = cvdRoc >= 0 ? color.new(#00c853, 40) : color.new(#d50000, 40)
// ─── Plots ────────────────────────────────────────────────────────────────────
hline(0, "Zero", color=color.new(color.gray, 50))
hline(0.5, "Bull Zone", color=color.new(#00c853, 70), linestyle=hline.style_dotted)
hline(-0.5, "Bear Zone", color=color.new(#d50000, 70), linestyle=hline.style_dotted)
plot(cvdNorm, "CVD Bias", color=cvdColor, linewidth=2)
plot(cvdRoc, "CVD Rate", color=rocColor, linewidth=1)
plotshape(bearDiv, "Bear Div", shape.triangledown, location.top, color=bearC, size=size.small, offset=-pivRight)
plotshape(bullDiv, "Bull Div", shape.triangleup, location.bottom, color=bullC, size=size.small, offset=-pivRight)
// ─── Dashboard ────────────────────────────────────────────────────────────────
color tc = color.new(color.gray, 20)
color hd = color.new(color.gray, 90)
var table t = table.new(position.top_right, 2, 5,
bgcolor=color.new(color.white, 5),
border_color=color.new(color.gray, 60), border_width=1,
frame_color=color.new(color.gray, 40), frame_width=1)
if showDash and barstate.islast and volumeIsReal
table.cell(t, 0, 0, "CVD Bias", text_color=tc, bgcolor=hd, text_size=size.small)
table.cell(t, 1, 0, "Value", text_color=tc, bgcolor=hd, text_size=size.small)
string cvdState = "Neutral"
if cvdNorm > 0.5
cvdState := "Strong Bull"
else if cvdNorm > 0.2
cvdState := "Bull"
else if cvdNorm < -0.5
cvdState := "Strong Bear"
else if cvdNorm < -0.2
cvdState := "Bear"
cvdC = cvdNorm > 0.2 ? bullC : cvdNorm < -0.2 ? bearC : tc
table.cell(t, 0, 1, "State", text_color=tc, text_size=size.small)
table.cell(t, 1, 1, cvdState, text_color=cvdC, text_size=size.small)
table.cell(t, 0, 2, "CVD", text_color=tc, text_size=size.small)
table.cell(t, 1, 2, str.tostring(cvdNorm, "#.##"), text_color=cvdC, text_size=size.small)
rocStr = cvdRoc >= 0 ? "Rising ↑" : "Falling ↓"
rocC2 = cvdRoc >= 0 ? bullC : bearC
table.cell(t, 0, 3, "Rate", text_color=tc, text_size=size.small)
table.cell(t, 1, 3, rocStr, text_color=rocC2, text_size=size.small)
divState = bearDiv ? "Bear Div!" : bullDiv ? "Bull Div!" : "—"
divC = bearDiv ? bearC : bullDiv ? bullC : tc
table.cell(t, 0, 4, "Divergence", text_color=tc, text_size=size.small)
table.cell(t, 1, 4, divState, text_color=divC, text_size=size.small)
// Kurzer Hinweis unten rechts; was fehlt, steht im Data Contract oben.
var table volWarn = table.new(position.bottom_right, 1, 1)
if barstate.islast and not volumeIsReal
table.cell(volWarn, 0, 0, "CVD · not available",
bgcolor = color.new(color.orange, 20), text_color = color.white, text_size = size.small)
// ─── Alerts ───────────────────────────────────────────────────────────────────
bool alertsOnBarClose = input.bool(true, "Alerts only on bar close (confirmed)", group="Alerts")
bool alertOk = not alertsOnBarClose or barstate.isconfirmed
alertcondition(alertOk and (bullDiv), "CVD Bull Divergence", "CVDB · BULL CVD DIV · {{ticker}} {{interval}}")
alertcondition(alertOk and (bearDiv), "CVD Bear Divergence", "CVDB · BEAR CVD DIV · {{ticker}} {{interval}}")
alertcondition(alertOk and (ta.crossover(cvdNorm, 0)), "CVD Cross Up", "CVDB · CROSS UP · {{ticker}} {{interval}}")
alertcondition(alertOk and (ta.crossunder(cvdNorm, 0)), "CVD Cross Down", "CVDB · CROSS DOWN · {{ticker}} {{interval}}")
Overview
CVD Bias [WavesUnchained] estimates signed volume from the close location inside each bar, multiplies that by volume, and sums the proxy over a rolling window. The sum is scaled between minus one and plus one, and a rate-of-change line shows whether the skew is building or fading. Optional pivots mark price extremes that oppose the proxy rate. A dashboard reports level, rate, and divergence, and alerts can wait until the bar closes. It requires real trade volume rather than tick counts or aggressor-side data.
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
Accumulation Window
int
50
cvdLen
Normalization Lookback
int
200
normLen
Rate of Change Length
int
5
rocLen
Detect Price/CVD Divergences
bool
true
enableDiv
Swing Left Bars
int
5
pivLeft
Swing Right Bars
int
5
pivRight
Show Dashboard
bool
true
showDash
Alerts only on bar close (confirmed)
bool
true
alertsOnBarClose
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.
Oscillator Suite plots a normalised price oscillator in a separate pane and overlays a signal line that can use SMA, EMA, WMA, HMA, RMA, VWMA, T3, ZEMA, KAMA, or GKEMA. It marks bullish and bearish divergences, a smoothed money-flow series, confluence areas an
This indicator plots a smoothed Z-score of cumulative volume delta in a separate pane, showing whether buying or selling pressure is dominant and when the reading enters extreme zones. It marks spot accumulation, climax or exhaustion, and pivot-based price-vol
Apex Vector is a separate-pane oscillator that plots a smoothed vector and classifies efficiency against superconductor and resistive thresholds, with a high-heat warning color. Optional volume flux uses a volume-normalization length. Users set vector length,
This indicator scans a pasted list of symbols for RSI directional momentum and shows matching long and short signals in a table in a separate pane. The user chooses continuous break, continuous retracement, flip break, flip retracement, divergence, or hidden d
This indicator calculates the Relative Strength Index (RSI) across four user-selected timeframes and plots the results in a separate pane. It identifies regular bullish and bearish divergences between price pivot points and the primary timeframe RSI value. Add
This indicator plots the Money Flow Index in a separate pane and marks regular and hidden bullish and bearish divergences between price pivots and the oscillator. It builds the index from positive and negative money flow, then finds pivot highs and lows using