Logic CDV
- Indicateurs
- Version: 1.0
LogicCDV - Cumulative Delta Volume Trend and Divergence
LogicCDV is a volume-driven trend and divergence indicator. It reconstructs the cumulative delta of volume from bar shape, builds a synthetic Heikin-Ashi series on it, and detects divergences between where price closes inside a bar and where the volume delta closes inside its HA candle. These divergences produce buy and sell events. A separate fractal-structure engine tracks breakouts of swing highs and lows to define trend direction.
Three layers, one indicator
1. CDV engine. Each bar's volume is split into buying and selling pressure by candle shape (wick and body ratio). The delta is accumulated, rendered as a synthetic candle, and smoothed with Heikin-Ashi. A strong disagreement between price close-position and delta close-position fires a buy or sell event. Thresholds are configurable; defaults are 76, 57, 35.
2. Market structure. Pivot fractals (7 left, 7 right) are stored in a rolling buffer. The engine selects the nearest swing high and low beyond an ATR(18) x 0.6 buffer, and clusters adjacent pivots within one ATR into a single level. The result is a robust last_high and last_low.
3. Trend machine. A close below last_low turns the trend to SELL. A close above last_high turns it to BUY. Levels recompute only on a trend change or a CDV event, so the trend is stable and does not flicker on every tick.
What you get
- Real-time BUY and SELL divergence signals.
- Trend state with an on-chart label and a colored background.
- Trend-change level line drawn as a ray from the breakout point.
- Optional vertical lines on trend changes.
- Optional pivot markers and ATR bands.
- On-bar CDV event labels showing the delta value.
- Alerts on bar close (popup, push, email), once per bar, with no spam burst on historical load.
Quality switches
Legacy exact-reproduction mode reproduces the original logic one-to-one, including its quirks, for side-by-side verification. Default mode ships with the original's bugs fixed: correct level initialization with no false BUY bias, level line redraw only on trend change, connected label colors, reachable alerts, and FIFO limits on chart objects.
Input groups
Visual. Labels. Alerts. Pivots and ATR. CDV thresholds. Engine.
Important notes
CDV is entirely volume-based. On instruments with real exchange volume (futures, stocks) the CDV reconstruction is exact. On retail forex, brokers report tick volume, which differs between brokers, so event magnitude and exact signal timing may differ between feeds. This is inherent to every volume-based tool, not a defect. CDV close-position ratios are invariant to the accumulation start point, so history depth does not affect them. Only a short warm-up of about 25 bars (ATR 18, pivots 7 and 7) is required.
Works on any symbol and timeframe. Best on liquid instruments with real volume. Use the CDV events as entry timing and the trend state as directional bias. Tune the thresholds per instrument via the CDV threshold inputs.
