PROTECTED SOURCE SCRIPT

QUANT - LAB MICROSTRUCTURE

20
Market microstructure analysis suite for liquidity diagnostics and transaction cost estimation.
Liquidity Metrics:

Return-Volume Sensitivity (Hasbrouck 1991 inspired proxy)
Roll Spread Estimator (Roll 1984) — effective spread from price autocovariance
Amihud Illiquidity Ratio (Amihud 2002) — price impact per dollar volume

Features:

Z-score normalization with configurable lookback
Automatic regime classification (Normal/Elevated/Extreme)
Roll validity detection (Cov < 0 requirement)
Data quality metrics and validity percentage tracking

Interpretation:

RVS: Price sensitivity to order flow (higher = more impact)
Roll: Effective bid-ask spread in bps (undefined when Cov > 0)
Amihud: Illiquidity measure (higher = harder to trade)

Dashboard Includes:

Real-time Z-scores with regime labels
Dollar volume and volume trend (20/60 ratio)
Realized volatility (annualized)
Roll spread validity monitoring

Important:

Z-scores are HEURISTIC thresholds (fat tails apply — ±2σ ≠ 95%)
RVS uses endogenous proxy — NOT true Kyle's Lambda
Roll undefined when serial covariance > 0 (momentum regime)
Research/diagnostic tool only — NOT a trading system

References: Kyle (1985), Roll (1984), Amihud (2002), Hasbrouck (1991), Lee & Ready (1991)

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.