Volumetric Structure Engine [JOAT]Volumetric Structure Engine
Introduction
The Volumetric Structure Engine is an institutional market structure tracker that fuses swing-point classification with real-time buy/sell volume delta analysis. Every confirmed swing high and swing low is measured not only by price, but by the net volume composition of the leg that produced it — revealing whether a structural move was driven by genuine institutional buying or selling, or whether it was a low-conviction, thin-volume probe. The indicator classifies market structure as HH/HL (bullish) or LH/LL (bearish), detects Break of Structure (BOS) and Change of Character (ChoCH) events on bar close, and renders each swing zone with a color gradient that reflects the underlying volume delta of that leg.
The core problem this solves: most market structure tools draw lines or arrows at swing points but say nothing about the quality of that swing. A break of structure on rising volume is categorically different from one on declining volume — the first signals institutional participation, the second suggests a liquidity grab. VSE quantifies that difference on every bar.
Core Concepts
1. Non-Repainting Swing Detection
Swings are confirmed using a lookback comparison pattern that resolves only on bar close:
float H = ta.highest(high, i_len)
float L = ta.lowest(low, i_len)
bool new_sh = high == H and high < H
bool new_sl = low == L and low > L
A swing high at bar N-1 is confirmed when bar N closes lower, meaning the prior bar's high was the highest in the lookback window. This approach never repaints because it always references the closed bar to the left.
2. Volume Delta Accumulation Per Leg
Between each confirmed swing, running buy and sell volume totals accumulate. On each bar, if close >= open the bar's volume is classified as buy-side; otherwise it is sell-side. When a new swing is detected, the accumulated totals are saved to that swing node, and the counters reset for the next leg:
if new_sh or new_sl
run_buy := 0.0
run_sell := 0.0
if close >= open
run_buy += volume
else
run_sell += volume
The delta percentage (buy minus sell divided by total volume) determines the color and transparency of each swing zone box. A leg with 80% buy delta renders as a vivid bull green; a leg with 20% buy delta renders as a vivid bear red. Neutral legs render in the neutral color.
3. BOS and ChoCH Detection
Break of Structure fires when confirmed price closes through the most recent confirmed swing extreme in the opposite direction. Change of Character fires when the first break occurs against the established trend — the earliest signal that the dominant structure may be shifting. Both signals are barstate.isconfirmed, preventing any lookahead.
4. Structure Cloud
A fill between the last confirmed swing high and swing low creates a visual structure range that updates dynamically. The cloud color matches the current trend direction and serves as an at-a-glance bias indicator for the session.
Features
Swing Zone Boxes: ATR-scaled zone boxes at every confirmed swing, colored by the net buy/sell delta of the producing leg
Volume Delta Gradient: Zone colors range from deep bull green (high buy delta) to deep bear red (high sell delta), with transparency encoding conviction
BOS Lines: Dashed horizontal lines drawn at the level where a Break of Structure closes, with text label
ChoCH Highlight: Change of Character events highlighted with a distinct yellow-amber color to distinguish them from continuation BOS signals
Structure Connection Lines: Lines connecting consecutive swing nodes, colored by the delta of each leg
Structure Cloud: Gradient fill between the last swing high and low showing current structural range
Candle Coloring: Optional candle tinting by current trend direction
9-Row Dashboard: Displays trend bias, last swing high/low price levels, structure range percentage, BOS bull/bear counts, ChoCH count, last leg delta percentage, and total swing node count
Alerts: BOS bullish, BOS bearish, ChoCH bullish, ChoCH bearish
Input Parameters
Structure Detection:
Swing Length: Lookback bars for swing high/low detection (default: 20, range: 5-200). Higher values identify fewer, stronger structural swings. Lower values are more reactive.
Show BOS Lines: Toggle BOS line rendering (default: on)
Show ChoCH: Toggle Change of Character highlighting (default: on)
Structure Cloud: Toggle the fill between swing high and low (default: on)
Visualization:
Bullish / Bearish / Neutral / ChoCH colors: Fully customizable
Zone Transparency: Control the base transparency of swing zone boxes (default: 78)
Color Candles: Optional candle tinting by structural trend (default: off)
Dashboard:
Position: Top Right, Top Left, Bottom Right, Bottom Left (default: Top Right)
How to Use This Indicator
Step 1: Read the Current Structure
The dashboard shows the current trend bias (BULLISH / BEARISH / NEUTRAL), the last confirmed swing high and low prices, and the structural range as a percentage. This gives you the directional context at a glance.
Step 2: Interpret Zone Colors
Zones colored in vivid green (high buy delta) represent legs driven by institutional buying. Zones colored in vivid red (high sell delta) represent institutional selling pressure. Faded or gray zones represent low-conviction legs — useful for identifying weak structure that is more likely to be swept.
Step 3: Trade BOS and ChoCH Events
A BOS in the direction of the existing trend is a continuation signal. A ChoCH (against the trend) is a structural shift signal and often marks the beginning of a reversal. Volume delta on the breaking leg adds conviction: a BOS on a high-buy-delta leg is more reliable than one on a low-delta leg.
Step 4: Use Swing Zones as S/R
Each swing zone box represents a price area where a structural pivot occurred. Institutional order flow often returns to these levels. High-delta zones in particular tend to act as meaningful support or resistance.
Originality Statement
This indicator is original in its combination of confirmed non-repainting swing structure with per-leg volume delta measurement. While market structure tools and volume analysis tools each exist independently, this indicator is justified because:
Volume delta is computed per structural leg — not per candle and not as a global indicator — creating a direct mapping between market structure quality and institutional participation
The swing confirmation method using the lookback comparison pattern eliminates repainting while maintaining responsiveness to genuine structural changes
Zone color encoding with delta-driven gradient creates an immediate visual hierarchy — strong zones versus weak zones — without requiring separate panels or indicators
BOS and ChoCH detection with volume delta context provides a more complete signal than either alone
Limitations
The buy/sell volume classification (close >= open = buy) is an approximation. True tick-level direction is not available in Pine Script. On very short timeframes where volume is sparse, classification may be imprecise
Swing length selection significantly affects structure quality. Too short produces noise; too long misses intermediate structure. Users should calibrate to their timeframe and instrument
BOS and ChoCH are confirmed on bar close, so they are identified one bar after the actual breakout candle closes. This is a deliberate trade-off for accuracy over speed
The indicator does not predict direction — it classifies the current structural state. A bullish structure can break down without warning
Disclaimer
This indicator is provided for educational and informational purposes only. It does not constitute financial advice or a recommendation to buy or sell any instrument. All trading involves risk of loss. Past structural patterns do not guarantee future results. Always use proper risk management.
-Made with passion by jackofalltrades
مؤشر Pine Script®






















