OPEN-SOURCE SCRIPT

Amihud Illiquidity Ratio [MarkitTick]

183
💡This indicator implements the Amihud Illiquidity Ratio, a financial metric designed to measure the price impact of trading volume. It assesses the relationship between absolute price returns and the volume required to generate that return, providing traders with insight into the "stress" levels of the market liquidity.

Concept and Originality
Standard volume indicators often look at volume in isolation. This script differentiates itself by contextualizing volume against price movement. It answers the question: "How much did the price move per unit of volume?" Furthermore, unlike static indicators, this implementation utilizes dynamic percentile zones (Linear Interpolation) to adapt to the changing volatility profile of the specific asset you are viewing.

Methodology
The calculation proceeds in three distinct steps:

1. Daily Return: The script calculates the absolute percentage change of the closing price relative to the previous close.
2. Raw Ratio: The absolute return is divided by the volume. I have introduced a standard scaling factor (1,000,000) to the calculation. This resolves the issue of the values being astronomically small (displayed as roughly 0) without altering the fundamental logic of the Amihud ratio (Absolute Return / Volume).
- High Ratio: Indicates that price is moving significantly on low volume (Illiquid/Thin Order Book).
- Low Ratio: Indicates that price requires massive volume to move (Liquid/Deep Order Book).
3. Dynamic Regimes: The script calculates the 75th and 25th percentiles of the ratio over a lookback period. This creates adaptive bands that define "High Stress" and "Liquid" zones relative to recent history.

How to Use
Traders can use this tool to identify market fragility:

- High Stress Zone (Red Background): When the indicator crosses above the 75th percentile, the market is in a High Illiquidity Regime. Price is slipping easily. This is often observed during panic selling or volatile tops where the order book is thin.
- Liquid Zone (Green Background): When the indicator drops below the 25th percentile, the market is in a Liquid Regime. The market is absorbing volume well, which is often characteristic of stable trends or accumulation phases.
- Dashboard: A visual table on the chart displays the current Amihud Ratio and the active Market Regime (High Stress, Normal, or Liquid).

Inputs
- Calculation Period: The lookback length for the average illiquidity (Default: 20).
- Smoothing Period: The length of the additional moving average to smooth out noise (Default: 5).
- Show Quant Dashboard: Toggles the visibility of the on-screen information table.

● How to read this chart

• Spike in Illiquidity (Red Zones)
Price is moving on "thin air." Expect high volatility or potential reversals.

• Low Illiquidity (Green/Stable Zones)
The market is deep and liquid. Trends here are more sustainable and reliable.

• Divergence
Watch for price making new highs while liquidity is drying up—a classic sign of an exhausted trend.

Example:

istantanea

● Chart Overview
The chart displays the Amihud Illiquidity [MarkitTick] indicator applied to a Gold (XAUUSD) 4-hour timeframe.

  • Top Pane: Price action with manual text annotations highlighting market reversals relative to liquidity zones.
  • Bottom Pane: The specific technical indicator defined in the logic. It features a Blue Line (Raw Illiquidity), a Red Line (Signal/Smoothed), and dynamic background coloring (Red and Green vertical strips).


● Deep Visual Analysis

• High Stress Regime (Red Zones)
  • Visual Event: In the bottom pane, the background periodically shifts to a translucent red.
  • Technical Logic: This event is triggered when the amihudAvg (the smoothed illiquidity ratio) exceeds the 75th percentile (hZone) of the lookback period.
  • Forensic Interpretation: The logic calculates the absolute price change relative to volume. A spike into the red zone indicates that price is moving significantly on relatively lower volume (high price impact). Visually, the chart shows these red zones aligning with local price peaks (volatility expansion), leading to the bearish reversal marked by the red box in the top pane.


• Liquid Regime (Green Zones)
  • Visual Event: The background shifts to a translucent green in the bottom pane.
  • Technical Logic: This triggers when the amihudAvg falls below the 25th percentile (lZone).
  • Forensic Interpretation: This state represents a period where large volumes are absorbed with minimal price impact (efficiency). On the chart, this green zone corresponds to the consolidation trough (green box, top pane), validating the annotated accumulation phase before the bullish breakout.


• Indicator Lines
  • Blue Line: This is the illiquidityRaw value. It represents the raw daily return divided by volume.
  • Red Line: This is the smoothedVal, a Simple Moving Average (SMA) of the raw data, used to filter out noise and define the trend of liquidity stress.


● Anomalies & Critical Data

• The Reversal Pivot
The transition from the "High Stress" (Red) background to the "Liquid" (Green) background serves as a visual proxy for market regime change. The chart shows that as the Red zones dissipate (volatility contraction), the market enters a Green zone (efficient liquidity), which acted as the precursor to the sustained upward trend on the right side of the chart.

● About Yakov Amihud

Yakov Amihud is a leading researcher in market liquidity and asset pricing.

• Brief Background
  • Professor of Finance, affiliated with New York University (NYU).
  • Specializes in market microstructure, liquidity, and quantitative finance.
  • His work has had a major impact on both academic research and practical investment models.


● The Amihud (2002) Paper

In 2002, he published his influential paper: “Illiquidity and Stock Returns: Cross-Section and Time-Series Effects”.

• Key Contributions
  • Introduced the Amihud Illiquidity Measure, a simple yet powerful proxy for market liquidity.
  • Demonstrated that less liquid stocks tend to earn higher expected returns as compensation for liquidity risk.
  • The measure became one of the most widely used liquidity metrics in finance research.


● Why It Matters in Practice

  • Used in quantitative trading models.
  • Applied in portfolio construction and risk management.
  • Helpful as a liquidity filter to avoid assets with excessive price impact.


In short: Yakov Amihud established a practical and robust link between liquidity and returns, making his 2002 work a cornerstone in modern financial economics.


Disclaimer: All provided scripts and indicators are strictly for educational exploration and must not be interpreted as financial advice or a recommendation to execute trades. I expressly disclaim all liability for any financial losses or damages that may result, directly or indirectly, from the reliance on or application of these tools. Market participation carries inherent risk where past performance never guarantees future returns, leaving all investment decisions and due diligence solely at your own discretion.

Declinazione di responsabilità

Le informazioni e le pubblicazioni non sono intese come, e non costituiscono, consulenza o raccomandazioni finanziarie, di investimento, di trading o di altro tipo fornite o approvate da TradingView. Per ulteriori informazioni, consultare i Termini di utilizzo.