Smart Money Liquidity Detector [PickMyTrade]Smart Money Liquidity Detector
This indicator measures market microstructure โ the structural signals that institutional activity leaves behind in price and volume data. It combines four academically grounded models into a single Microstructure Stress Score (MSS) ranging from 0 to 100.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
MODELS USED
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โบ Roll (1984)
Synthetic bid-ask spread estimated from the serial covariance of price changes. High Roll spread indicates wider market-maker quotes โ historically associated with periods of elevated volatility.
โบ Corwin-Schultz (2012)
High-low range spread estimator. Uses the relationship between single-period and two-period high-low ranges to back out the effective spread without requiring tick data.
โบ Amihud (2002)
Illiquidity ratio measuring price move per unit of volume. High Amihud values mean large price impact per dollar traded โ a sign of thin order books.
โบ Kyle Lambda (1985)
Price impact of signed order flow. Derived from the regression of price changes on volume direction. Estimates how aggressively informed participants are moving the market.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
MICROSTRUCTURE STRESS SCORE (MSS)
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Each model is z-scored over a rolling window, normalised to , then averaged and scaled to 0โ100.
MSS = (Roll + Corwin-Schultz + Amihud + Kyle Lambda) / 4 ร 100
- MSS > 70 โ High stress. Spreads wide, illiquidity elevated, price impact high. Consistent with institutional order flow.
- MSS 30โ70 โ Normal range. No structural signal.
- MSS < 30 โ Low stress. Tight spreads, liquid conditions, quiet tape.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
ANOMALY DETECTION
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Any individual model z-score crossing ยฑ2ฯ triggers an anomaly flag. Anomaly bars are highlighted in orange on the chart. Roll and Corwin-Schultz anomalies are marked with coloured circles directly on the MSS line.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
INPUTS
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
- Spread window (default 20) โ lookback for Roll and Corwin-Schultz estimation
- Z-score window (default 60) โ rolling window for z-scoring all models
- Impact window (default 20) โ lookback for Amihud and Kyle Lambda
- MSS normalise window (default 100) โ window for normalisation before scoring
- Toggle each model's z-score plot individually
- Highlight anomaly bars on/off
- Info table on/off
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
INFO TABLE
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Top-right table displays live values and z-scores for all four models, the current MSS reading, and anomaly status on the last closed bar.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
NOTES
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
- Works on any liquid instrument and any timeframe. Most effective on futures, forex, and equity indices where volume data is reliable.
- This indicator does not generate buy or sell signals. It is a market structure diagnostic tool.
- Powered by PickMyTradeLib โ PickMyTrade's open quantitative library.
This script is published for educational and informational purposes only. It does not constitute financial advice. Use at your own risk. Past microstructure behaviour does not guarantee future price outcomes.
Pine Scriptยฎ indicator






















