OPEN-SOURCE SCRIPT

ALEX Liquidity & Elasticity Index (ALEX)

193
🚀 ALEX Liquidity & Elasticity Index (ALEX)

The ALEX Liquidity & Elasticity Index is an institutional-grade, quantitative market microstructure oscillator designed to measure liquidity stress, price elasticity, and hidden supply-demand imbalances in real time. Built on a fusion of Amihud illiquidity modeling, volatility-normalized divergence engines, and adaptive Gaussian smoothing systems, this indicator engineered by gunebak4n isolates the true underlying behavior of market liquidity flow rather than raw price movement.

Unlike traditional oscillators that rely purely on momentum or overbought/oversold assumptions, ALEX reconstructs market behavior through a multi-layered statistical architecture that combines price impact sensitivity, volume efficiency, and divergence pressure into a single bounded regime signal.

The result is a clean, adaptive, and institutionally relevant liquidity spectrum that highlights when markets are expanding aggressively, compressing into accumulation phases, or transitioning into unstable imbalance regimes.

💡 Key Features

🧠 Liquidity Stress Engine (Amihud Core Model):
ALEX measures the relationship between price returns and dollar volume efficiency to estimate real-time market illiquidity. This allows detection of hidden execution stress that is not visible on standard price charts.

📊 Divergence Pressure System:
By comparing price momentum (ROC) against volume momentum, ALEX detects structural imbalance between buyers and sellers. This divergence layer acts as the core driver of regime classification.

🔬 Adaptive Gaussian Smoothing Architecture:
Multi-stage Gaussian filtering removes microstructure noise while preserving macro trend integrity. This ensures the signal reflects structural liquidity shifts rather than short-term volatility spikes.

⚡ Dynamic Regime Normalization:
All raw outputs are transformed into a bounded oscillator (-100 to +100) using adaptive scaling logic. This allows consistent interpretation across different market conditions and assets.

🛡️ Volatility-Responsive Threshold System:
Upper and lower extreme zones automatically adjust based on realized volatility. This ensures that signal sensitivity adapts to changing market regimes rather than relying on static levels.

📉 Liquidity Regime Classification:
ALEX dynamically categorizes market conditions into:

* Liquidity Vacuum (Aggressive Expansion / Stress Imbalance)
* Accumulation Zone (Absorption / Passive Buy Pressure)
* Trending Imbalance (Directional Continuation Phase)
* Balanced Regime (Neutral Equilibrium State)

🔬 Mathematical Logic and Structure

ALEX is constructed as a multi-layer liquidity-state transformation system that converts raw market microstructure into a bounded regime oscillator.

The model begins by defining market impact through an adapted Amihud Illiquidity framework, where price movement is evaluated relative to available trading volume. This creates the foundational liquidity stress variable, representing how “expensive” price movement is in current market conditions.

From there, the system applies statistical normalization using a rolling Z-score transformation. This step converts raw liquidity stress into a standardized deviation measure, allowing comparison across different volatility regimes.

To capture hidden structural imbalance, ALEX introduces a divergence engine between price momentum and volume momentum. When price acceleration is not confirmed by volume expansion, the system registers negative structural support; when both expand in sync, liquidity confirmation strengthens directional conviction.

These two components—liquidity stress and structural divergence—are then fused into a single composite pressure field. This field represents the core behavioral signal of the market: whether movement is liquidity-driven, absorption-based, or structurally supported.

To eliminate microstructure noise, the composite signal is passed through a multi-stage Gaussian smoothing process, followed by a median aggregation layer. This ensures that only macro-level liquidity transitions are preserved while short-term distortions are filtered out.

Finally, the processed signal is mapped into a bounded oscillator space (-100 to +100) using adaptive range normalization based on recent historical extremes. This transforms raw statistical pressure into a stable regime classification framework, enabling consistent interpretation across all market conditions.

In essence, ALEX does not track price. It reconstructs the *cost of price movement under current liquidity conditions* and translates it into a structured regime map of accumulation, expansion, imbalance, and equilibrium.

🛠️ How to Use

1. Liquidity Vacuum Zones (Red Extremes):
Indicates aggressive expansion of price impact relative to available liquidity. Often associated with exhaustion moves, breakout failures, or forced liquidations.

2. Accumulation Zones (Green Extremes):
Suggests absorption of sell pressure and hidden institutional accumulation. Typically observed before structural bullish expansions.

3. Trending Regime (Mid Zones):
When the system enters transitional imbalance, directional continuation becomes dominant. Momentum strategies perform optimally in this phase.

4. Balanced Regime (Neutral Zone):
Indicates equilibrium between supply and demand. Price action becomes mean-reverting and low edge for directional trades.

🎛️ Settings

* Calculation Window (34): Core statistical sensitivity of liquidity modeling
* Median Smoothing Length (7): Outlier suppression for price/volume data
* Signal Smoothing Length (21): Macro trend stabilization layer
* Scaling Lookback (60): Normalization horizon for oscillator compression
* Volatility Sensitivity (1.5): Controls adaptive threshold expansion

📌 Credits and Origins

This indicator is engineered by gunebak4n, combining modern market microstructure theory, liquidity impact modeling, and adaptive statistical filtering techniques into a unified analytical framework.

ALEX is designed for professional traders, quant-style discretionary operators, and algorithmic systems that require a clean representation of liquidity-driven market behavior rather than purely price-based momentum interpretation.

⚠️ Disclaimer

All outputs generated by the ALEX Liquidity & Elasticity Index are probabilistic in nature. The indicator does not predict outcomes or guarantee performance. It is a decision-support tool intended for structural market analysis only. Proper risk management and execution discipline remain mandatory at all times.

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.