Amihud Illiquidity Measure
The Amihud illiquidity measure, published by Yakov Amihud in 2002, is a simple and widely used proxy for how much a given amount of trading moves the price: for each period, take the absolute return divided by that period's traded volume, then average over a rolling window. A high value means price moved a long way on comparatively little volume - a thin, illiquid market. A low value means it took a lot of volume to move price at all - a deep, liquid one. The published formula uses real traded (dollar) volume. No MetaTrader 4 feed exposes real volume for FX or CFDs - only broker tick volume (the count of price changes per bar) is available. This indicator substitutes tick volume for real volume in the same ratio and says so plainly, both here and on the chart's short name. The result is directionally the same statistic - it still rises when price moves a long way on comparatively few ticks - but it is a proxy for participation, not a literal reproduction of the academic ratio against genuine executed size. Treat it as a relative, cross-time comparison on one symbol, not as a value to compare directly against a published equity-market Amihud figure. Each bar's ratio is |return| / tick volume for that bar; the plotted line is the average of the last InpIlliqWindow such ratios, multiplied by InpScale purely so the number prints in a readable range (matching the common academic convention of scaling the raw ratio, which is otherwise a very small decimal). A second, smoother line shows the InpSmoothPeriod moving average of the raw ILLIQ line, useful for spotting a trending change in liquidity rather than reacting to noise bar to bar. Notes and limitations - Uses broker tick volume as a substitute for the real traded volume the published Amihud formula calls for - stated above, not hidden. Absolute values are not comparable across symbols or against published equity-market ILLIQ figures; only the trend on one symbol over time is meaningful. - A bar with zero tick volume (no quotes arrived) is excluded from that window's average rather than treated as infinitely illiquid. - Needs InpIlliqWindow + InpSmoothPeriod + 1 bars of history before it starts plotting.
Indicator · MT4 · v1.0 · Free
About Amihud Illiquidity Measure
Amihud Illiquidity Measure is an indicator for MetaTrader 4. It has 3 settings, such as Illiq window, Smooth period and Scale. MQL source code included.
Files in the download: AmihudIlliquidity.ex4, AmihudIlliquidity.mq4, AmihudIlliquidity.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Illiq window | 20 | Bars averaged into each ILLIQ reading (the Amihud window) |
| Smooth period | 10 | SMA period applied to the ILLIQ line for a readable trend |
| Scale | 1000000 | Multiplier so the ratio prints in a readable range (academic papers scale similarly) |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Indicators.
- Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
- Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
- Drag the indicator from the Navigator onto a chart and adjust the settings.
Tags: Volume · MT4 Indicator · MQL4 Source Code