Liquidity Divergence OscillatorOverview
Liquidity Divergence Oscillator is a distribution / absorption detector. It estimates liquidity health from Kyle's lambda — the price impact per unit of signed volume — and reads it for divergence against price. When price grinds to a higher high while liquidity health makes a lower high, large participants are often unloading size into strength (a distribution footprint); the mirror — price lower low, health higher low — is absorption. A forward-calibration harness scores whether those price/liquidity divergences have actually followed through on your instrument. It is a flow-structure read, not a signal to trade alone.
Why it is different — not another CVD/volume oscillator
CVD, the A/D line and MFI all measure the direction and amount of flow — who is buying or selling. Kyle's lambda measures something orthogonal: how much price moves per unit of that flow — the depth and fragility of the book. Price pushing to new highs while lambda quietly rises (liquidity thinning) is the classic footprint of size being distributed into strength, and no direction-only flow tool sees it. That impact axis is what makes a liquidity divergence its own, independent read — and it's why this belongs alongside your CVD tools rather than duplicating them. It's also distinct from a liquidity map: this is a standalone divergence oscillator, built to surface the turn, not to chart the shelves.
How the parts work as one tool
Signed volume — sv = volume × sign(price change), a tick-rule aggressor proxy.
Kyle's lambda — Cov(ΔP, sv) / Var(sv) over a rolling window: the regression slope of price change on signed flow, the standard lambda estimator. High = thin/stressed book, low = deep/liquid.
Liquidity health — −z(lambda), smoothed and tanh-squashed to a soft ±100 pane so "liquid vs stressed" reads on a fixed, self-scaling axis (0 = balance, ±50 ≈ a 1.6σ stretch).
Divergence — regular and hidden, from confirmed price pivots against health at those pivots.
Calibration harness — each regular divergence is queued and resolved a fixed horizon later against the unconditional base rate, reporting Hit / Edge / sample and a Wilson-gated star. A divergence class that never beats the base rate here is adding no information — and the dashboard shows that instead of assuming it.
How to use it
Read the oscillator's side and slope — above 0 is liquidity firming, below 0 is liquidity stressed. Treat a divergence mark as context (a distribution or absorption warning), never a standalone entry. Before you weight it, check the dashboard: if the Bull/Bear Edge isn't clearly positive with an adequate sample and a star, that class isn't carrying an edge on this instrument. Signals are marked in the pane and, optionally, on the price chart. Combine with your own levels, trend and risk rules — it describes behaviour; it decides nothing.
Universal & non-repainting
High/Low/Price are inputs, so the divergence engine runs on any series; the lambda estimate needs real volume, so use the futures (a cash index reads "no volume"). Pivots confirm a fixed number of bars after the fact and don't move once printed, and the calibration harness logs and resolves only on confirmed bars, so its statistics never repaint intrabar. The live oscillator updates each bar like any oscillator. Edge figures are in-sample, forward-measured at a fixed horizon, with no costs — a study aid, not a backtest.
Originality
Kyle's lambda and price/oscillator divergence are public; the Wilson interval is Edwin B. Wilson's. What's original is the specific construction: the detrend → z-score → tanh-squash liquidity-health oscillator built off the lambda estimate, the combined regular+hidden divergence engine keyed to it, and the forward-calibration harness that scores each divergence class against its base rate. Clean-room implementation; no third-party Pine code reused.
Concept credits
Price impact / lambda — Albert S. Kyle (1985)
Tick-rule aggressor signing — after the classic trade-sign literature (Lee & Ready)
Wilson score confidence interval — Edwin B. Wilson
Price/oscillator divergence — standard public technical-analysis technique
Disclaimer
Educational / informational only. Not financial advice, not a signal, not a recommendation. The lambda estimate uses tick-rule signed volume — a proxy, not the true tape — so liquidity health is an inference, not an order-book reading. Edge figures are in-sample, forward-measured with no costs. Past behaviour does not assure future behaviour. Markets carry risk. Do your own research and paper-trade before risking capital; you alone are responsible for your decisions.
Indicator

Fragility-Weighted Liquidity Map Kyle Amihud RollFragility-Weighted Liquidity Map — Kyle · Amihud · Roll
What it is
A move of the same size means opposite things depending on the book beneath it. Into a thin book, a move is mostly price impact — mechanical, fragile, prone to snap back. Into a deep book, the same move took real participation and is more likely informed. This tool estimates how impact-driven the tape is right now from three classic microstructure measures, fuses them into one fragility read, and tints recent liquidity levels by it. It scales conviction and risk — it never picks a direction.
The three measures (all from OHLCV, peer-reviewed)
Kyle's lambda (Kyle 1985) — price impact per unit of signed volume: |price change over a window| ÷ |Σ sign(Δclose)·volume|. High λ = each unit of flow moves price a lot = thin, impactable.
Amihud illiquidity (Amihud 2002) — the average of |return| ÷ dollar-volume. High = small volume moves price a lot. (Empirically ~0.8 correlated with Kyle, so the two are blended, not double-counted.)
Roll implied spread (Roll 1984) — the effective spread implied by the bid-ask bounce: c = 2·√(−Cov(Δp, Δp₋₁)) when that covariance is negative. When it is positive — common in trends — the Roll model does not apply, so the estimate is shown as not measurable here rather than forced to a number. That honesty is deliberate.
Fusion → fragility
Each measure is ranked against its own recent history (a percentile), so the read self-tunes to the symbol and timeframe. The fragility index is the weighted blend of whichever measures are currently available (Roll drops out in trends, and the blend adapts). High fragility = impact-driven, reversible tape; low = deep, informed. A plain-language read suggests trusting breakouts less and fades more when fragility is high — as context, not a signal.
The map
Bars that trade unusually large volume leave a horizontal liquidity level where size changed hands. Each level is tinted by the fragility state at the moment it formed: warm = it printed in a thin/impact-driven tape (a weaker level, more likely to be swept); cool = it printed in a deep/informed tape (sturdier). So the map shows not just where liquidity sits but how trustworthy each pocket is.
How to use it
Add to any liquid symbol/timeframe; defaults suit index futures — change the price/volume sources for other markets.
Glance at the fragility lane — the thin strip at the pane bottom: red = thin/fragile, green = deep/solid, gray = normal. Risk-semantic colors (danger/safe), never direction. That strip alone answers "how careful should I be" for a non-technical user.
States are dwell-filtered (standard anti-chattering): a new THIN/DEEP/NORMAL is announced only after surviving a set number of bars, so the read doesn't flip-flop. STABILITY shows how settled it is; PENDING shows a forming state with a countdown. The cost is a few bars of lag — stated and adjustable.
The HTF STACK row shows the raw fragility state on three higher timeframes derived as multiples of the chart (defaults 3×, 5×, 15× — a 5m chart reads 15m/25m/75m automatically). ✓ green = all timeframes agree on the same actionable state; ⚠ amber = a higher timeframe reads the opposite state.
Read the dashboard: DEEP / NORMAL / THIN, the three measures' ranks, and a suggested size factor. As it turns THIN, treat moves as more reversible: size down, favour fades over breakout-chasing.
Use the rails as liquidity references coloured by trust — a warm rail formed in fragile conditions; a cool rail in solid ones.
Pairs with Order-Flow Criticality: that tool asks whether flow is self-exciting (endogenous); this asks whether the book is thin (impactable). Both elevated together is the genuinely fragile state.
What makes it original
Retail liquidity tools draw where volume traded. This one weights each level and the whole tape by how impactable it is, using three peer-reviewed microstructure estimators computed from bar data, self-calibrated, and — crucially — honest about when the Roll model doesn't apply. Reframing a liquidity map from "where is liquidity" to "how fragile is liquidity" is the contribution.
Concept credits
Price impact of order flow (lambda) — A. S. Kyle (1985). Illiquidity ratio — Y. Amihud (2002). Implied effective spread from serial covariance — R. Roll (1984). Square-root impact refinement — J. Hasbrouck. Fragility framing — general market-microstructure literature. Implementation and charting design are the author's own.
Important disclaimer
Research and education only. Not financial advice, not a signal service, not a guarantee of future results. These are proxies estimated from bar data, not order-book truth, and they do not predict direction. Validate independently and manage your own risk. Indicator

Order Flow Microstructure Engine# Order Flow Microstructure Engine
**Order Flow Microstructure Engine** condenses a full stack of order-flow and market-microstructure measures into a single decision: one confidence %, one tier, and one action with entry/stop levels — shown in an adaptive on-chart dashboard. It is built to answer one question on every bar: *are aggressive buyers or aggressive sellers in control, and how convinced should you be?*
This is not a bundle of unrelated indicators placed on one chart. Every component measures a **different facet of the same process** — the buy/sell auction happening inside each bar — and they are combined inside **one probabilistic model**. The reason for the mashup, and how the parts interact, is described below as the guidelines require.
**Why these components are combined (mashup justification)**
No single order-flow measure is reliable alone: raw delta misleads during absorption, CVD drifts, footprint imbalances appear in chop, and toxicity rises at both reversals and breakouts. Because these weaknesses are *partially independent*, fusing the measures correctly cancels noise that any one of them carries. The original element is **how** the fusion is done — not what is plotted.
**How it works (the pipeline)**
1. *Reconstruction.* Lower-timeframe sub-bars are pulled and each is classified buy/sell with a tick-rule cascade (after Lee & Ready). Where the data plan exposes native volume footprint, real bid/ask is used and aggregated into the same price bins. The dashboard always shows whether it is running on reconstructed (`RECON`) or native (`NATIVE`) data.
2. *Factors.* From that base it derives Aggressor Imbalance Ratio, Cumulative Volume Delta, footprint imbalances/POC, auction Value-Area efficiency (acceptance vs rejection), integrated multi-level Order-Flow Imbalance (depth-weighted), VPIN-style flow toxicity, Kyle's lambda price-impact/liquidity, a directional self-exciting (Hawkes) intensity, and a square-root-law absorption measure.
3. *Fusion (the original part).* Each factor is mapped to a probability and combined in Bayesian log-odds. Crucially, the flow-derived factors are **decorrelated before fusion** using an effective-sample-size (design-effect) shrinkage, so factors that are really the *same evidence* (AIR, delta, CVD, footprint, OFI) cannot inflate confidence just by agreeing. Structurally independent factors (auction efficiency, MOC, Hawkes, absorption, cross-instrument) enter at full weight. The posterior is then gated by multi-timeframe and multi-horizon consensus and damped by a regime-thrash (chop) penalty, producing one confidence → a 5-tier ladder → an action.
Without this combination you would get several conflicting opinions; the value is the **correlation-aware fusion** that turns them into one calibrated read.
**How to use it**
- Apply to a liquid instrument on an intraday timeframe (1m–1h). Defaults are tuned for index futures on 5-minute charts with 5-second sub-bars.
- Read the Compact dashboard top-down: ACTION + confidence %, Tier (position-size guidance), Entry/Stop, then CO-FIRE confluence, multi-timeframe and regime/stability. Switch "Table view mode" to Full for a complete factor-by-factor breakdown.
- On-chart triangles mark Tier-1/Tier-2 long/short signals across history; footprint boxes show the intrabar buy/sell distribution.
- For other markets: change the **Market preset** (group 01). Choose **CUSTOM** to set your own session, MOC window, footprint bin sizing and CVD reset — making it usable on any instrument in any market.
- The dashboard theme auto-adapts to a light or dark chart background.
**What makes it original**
Correlation-aware decorrelated Bayesian fusion of order-flow factors; a native-footprint seam that uses real bid/ask when available and transparently falls back to reconstruction; layered multi-horizon + multi-timeframe + cross-instrument confirmation on a microstructure base; and a regime-stability filter that penalizes only genuine directional reversals, not same-direction intensity changes.
**Honesty / limitations**
On most retail feeds, order flow here is reconstructed from lower-timeframe data via the tick rule (~75–80% trade-sign accuracy), not true exchange bid/ask, unless your plan provides native footprint data. The data source is shown in the dashboard. This is an analytic and educational tool, not financial advice and not a guarantee of results.
**Concept credits**
Lee & Ready (trade sign); Kyle (price impact / lambda); Easley, López de Prado & O'Hara (VPIN); Cont, Kukanov & Stoikov and Xu, Gould & Howison (OFI / multi-level OFI); Hawkes and Bacry–Muzy (self-exciting intensity); Almgren and Tóth–Bouchaud (square-root impact law); Kaufman (Efficiency-Ratio adaptation); Steidlmayer (Market Profile / Value Area); Kish (design effect). All Pine implementations are original re-derivations; no external script code is used.
**Disclaimer**
For research and educational purposes only. Nothing here is financial advice. Markets carry risk and past behaviour does not guarantee future results. Always do your own research and manage risk.
Indicator
