OPEN-SOURCE SCRIPT

Delta Microstructure Analysis

125
Delta Microstructure Analysis

Market microstructure analysis using footprint data for divergence, exhaustion, absorption, and trapped trader detection

Overview

Delta Microstructure Analysis is an order flow indicator that uses TradingView's footprint data to identify market conditions including divergences, exhaustion patterns, absorption zones, and trapped trader scenarios. The indicator calculates delta at each bar and tracks cumulative delta to identify potential reversals and continuations.

Key Features

  • Footprint Data Integration: Uses TradingView's built-in footprint data for accurate buy/sell volume delta calculation. Falls back to synthetic delta calculation when footprint data is unavailable.
  • Adaptive Tick Calculation: Automatically adjusts footprint tick size based on asset type and timeframe. Baseline values: crypto (200), forex (10), stocks (5), indices/futures (1), with timeframe scaling.
  • Cumulative Volume Delta (CVD): Tracks cumulative delta with reset options (None, Daily, Fixed Bars) to identify overall buying/selling pressure trends.
  • Divergence Detection: Identifies bullish and bearish divergences between price action and cumulative delta using configurable pivot strength (3-20 bars).
  • Exhaustion Pattern Recognition: Detects buying and selling exhaustion when delta exceeds configurable multiplier (2.0-10.0x) of average delta over lookback period (10-100 bars).
  • Absorption Zone Analysis: Identifies areas where aggressive orders are absorbed by resting liquidity, indicating potential support/resistance zones.
  • Trapped Trader Detection: Recognizes scenarios with strong initial momentum followed by sharp reversals, suggesting trapped positions.
  • Visual Labeling System: Displays signals as monospace labels (DIV↑/DIV↓, EXH↑/EXH↓, ABS↑/ABS↓, TRAP↑/TRAP↓) above/below candles.
  • Info Table Display: Shows current CVD, delta, average delta, data source, and active signals in a monospace-formatted table.
  • Alert System: Individual alerts for each signal type (divergences, exhaustion, absorption, trapped traders).


How It Works

  1. Footprint Data Request: The indicator requests footprint data using adaptive tick sizing. If unavailable, uses synthetic delta calculation based on candle characteristics.
  2. Delta Calculation: For footprint data, uses fp.delta() function. For synthetic delta, considers body size, wick analysis, and volume characteristics.
  3. Cumulative Delta Tracking: Maintains running cumulative delta that resets based on selected mode (daily session changes or fixed bar intervals).
  4. Pivot Detection: Uses configurable pivot strength to identify significant highs and lows in both price and cumulative delta.
  5. Divergence Analysis: Compares price pivots with cumulative delta pivots. Bullish divergence: lower price lows with higher delta lows. Bearish divergence: higher price highs with lower delta highs.
  6. Exhaustion Detection: Calculates average absolute delta over lookback period and identifies when current delta exceeds multiplier threshold.
  7. Absorption Identification: Analyzes footprint patterns to detect when aggressive orders are met with sufficient resting liquidity.
  8. Trapped Trader Recognition: Identifies strong momentum followed by sharp reversals using proprietary pattern recognition.
  9. Signal Display: Shows signals as labels on chart and summarizes in info table with current market conditions.


Use Cases

  • Divergence Trading: Use divergence signals to identify potential trend reversals before they appear in price action.
  • Exhaustion Monitoring: Identify when buying or selling pressure may be exhausted, suggesting potential reversals.
  • Support/Resistance Levels: Use absorption zones to identify key price levels where institutional activity occurs.
  • Risk Management: Use trapped trader signals to anticipate sharp reversals and adjust position sizing.
  • Market Structure Analysis: Understand underlying order flow dynamics driving price movements.
  • Confirmation Tool: Combine with other technical indicators to confirm signals and improve trade probability.


Settings

Footprint Settings:
  • Use Footprint Data: Toggle between footprint and synthetic delta
  • Tick Size Mode: Auto (adaptive) or Manual tick sizing
  • Tick Density Multiplier: Adjusts price bucket size in footprint data
  • Manual Footprint Ticks: Custom tick size for Manual mode


CVD Settings:
  • CVD Reset Mode: None, Daily, or Fixed Bars
  • Reset Every N Bars: Number of bars between resets (10-1000)


Divergence Settings:
  • Pivot Strength: Bars required for pivot detection (3-20)
  • Show Divergence Lines: Toggle line display
  • Bullish/Bearish Divergence Color: Custom colors
  • Divergence Line Width: Line thickness (1-5)


Exhaustion Settings:
  • Delta Multiplier: Threshold multiplier (2.0-10.0)
  • Lookback for Avg Delta: Period for average calculation (10-100)
  • Show Exhaustion Markers: Toggle signal display


Display Options:
  • Show Info Table: Toggle table display
  • Table Position: Choose table location on chart


Table Styling:
  • Background, text, and border colors
  • Header styling options


Label Styling:
  • Label text color


Alert Settings:
  • Individual toggles for each signal type


Technical Notes

  • The indicator uses TradingView's footprint functions (request.footprint(), fp.delta()) for order flow analysis.
  • Adaptive tick calculation converts all timeframes to minutes for consistent scaling across chart intervals.
  • Synthetic delta calculation uses body size (70% weight), wick analysis, and body-to-range ratio for fallback when footprint data unavailable.
  • The indicator uses barstate.isconfirmed for calculations to prevent repainting.
  • All text displays use monospace font for consistent readability.
  • Table displays current CVD, delta, average delta, data source, and active signals in real-time.


Best Practices

  • Use on symbols where footprint data is available for most accurate analysis.
  • Combine divergence signals with price action for higher probability setups.
  • Monitor exhaustion signals in context of overall trend direction.
  • Pay attention to absorption zones at key technical levels.
  • Use trapped trader signals as early warning for potential reversals.
  • Adjust pivot strength based on trading timeframe (lower for shorter timeframes).
  • Consider data source indicator - synthetic delta may be less reliable than footprint data.
  • Set up alerts for preferred signal types when monitoring multiple symbols.


This indicator analyzes market microstructure using footprint data to identify divergences, exhaustion, absorption, and trapped trader patterns.

Pernyataan Penyangkalan

Informasi dan publikasi ini tidak dimaksudkan, dan bukan merupakan, saran atau rekomendasi keuangan, investasi, trading, atau jenis lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Ketentuan Penggunaan.