OPEN-SOURCE SCRIPT
Liquidity Map & Order Blocks [MQLSoftware]

Liquidity Map & Order Blocks reads swing structure into a density map of where stop-liquidity rests, then projects which pool price is most likely drawn toward next. Equal highs and lows are grouped into bands whose brightness scales with a multi-factor Liquidity Score, sweeps mark where those pools were hunted, and a forward-looking model expresses the most likely draw as a self-calibrating historical hit-rate rather than a fixed number. A compact right-side panel adds chart and higher-timeframe structure, the net liquidity pull, the draw target, and pool counts.
This is a visual analytical tool intended for chart reading and liquidity mapping. It does not execute trades and does not provide financial advice. It does not generate buy or sell signals and makes no claim about profitability or win rate. The draw percentage describes how often similar pools were reached in the past over the loaded data; it is a descriptive statistic, not a prediction, and past behavior does not guarantee future results.
Key Features
Core Concept
Most liquidity and order-block tools on TradingView take one of two approaches. They either draw raw equal-high / equal-low lines and mark every order block and gap without ranking them, which clutters the chart and leaves the reader to judge which level matters, or they label structure (swings, breaks of structure) without projecting where liquidity is likely to pull price next. Both stop short of a scored, forward-looking read.
This indicator builds on a different base: cluster swing levels into scored density bands, gate order blocks by structure, and add a model for the next likely draw that is calibrated against realized history. It adds three specific algorithmic elements on top of that base.
1. ATR-Normalized Liquidity Clustering with a Multi-Factor Score. Swing highs and lows are not drawn as individual lines. They are grouped along the price axis by a clustering pass whose merge distance scales with ATR, so equal-ish levels collapse into a single pool and the behavior stays consistent across instruments. Each pool carries a Liquidity Score built multiplicatively from a saturating touch count, an age-decay term, relative volume at the forming pivots, and rejection-wick depth, so a band's brightness reflects how heavy and how fresh the resting liquidity is rather than only how many times the level was touched.
2. Draw on Liquidity Projection. Each unmitigated pool is treated as an attractor. Its pull is the product of its Liquidity Score, an exponential proximity kernel in ATR units, a structural prior that favors pools lying in the trend's continuation direction relative to current price, and a path-clearance term that discounts a pool when other strong pools sit between it and price. The strongest-pull pool is projected as the draw target, and the projection is deliberately muted when confidence is low, so a weak draw never reads like a strong one.
3. Self-Calibrating Empirical Hit-Rate. The draw percentage is not a fixed weight. Each draw is profiled into a bucket defined by Liquidity Score, distance, and structural alignment, and as the chart's history is processed the script records how often pools of that profile were actually reached within a configurable horizon. The displayed figure is the empirical reach frequency of that bucket, smoothed with a weak prior so thin samples are shown as provisional rather than over-read. It calibrates per symbol and timeframe with no fixed accuracy claim attached.
Anatomy of the Display
Liquidity bands are the horizontal zones spanning each pool, colored for buy-side (above) and sell-side (below) liquidity; the brighter a band, the higher its Liquidity Score. Swept pools dim to grey so a hunted level is visually retired.
The draw projection is the arrow from current price to the strongest-pull pool, with a price-side chip and an arrowhead pointing the modelled direction. Its weight scales with the hit-rate: a high-confidence draw is bold, a low-confidence one is thin and faded. The label reads the target level, the hit-rate (shown as a provisional `~NN% (n…)` while its sample is small), and whether the pool is buy-side or sell-side liquidity.
Sweeps mark a stop-hunt of the last significant swing: a wick beyond it that closes back within. The two most recent are labelled; older ones are compact marks so the chart stays clean.
Structure is drawn as Break of Structure and Change of Character lines from a protected-swing state machine; a toggle renders these in plain language (Trend break / Reversal) for readers new to the terminology.
Order blocks are the boxes drawn at the last opposite candle before a Break of Structure, so only structure-originating blocks appear; the optional Fair Value Gap layer marks three-candle imbalances aligned with the break. Both fade once price mitigates them.
The right-side panel lists chart structure, the net liquidity pull and its strength, the draw target with its hit-rate, pool counts per side, and a per-row higher-timeframe bias scan with a strength bar.
Multi-Timeframe Panel
The panel reads three higher timeframes of your choice for structural bias and trend strength, using the same protected-swing engine as the chart. Higher-timeframe values are read with `lookahead=barmerge.lookahead_off` and a one-bar offset, which is the standard non-repainting pattern for higher-timeframe context. A divergence between the chart's structure row and the liquidity pull is informative rather than contradictory: structure up while the draw points down with a high hit-rate, for example, frames an expected pullback toward a strong pool below.
Notes on Repainting
Typical Analysis Workflow
A common analytical workflow may include:
Configuration
Structure Engine - ATR length, pivot left / right bars, and the swing filter that sets how significant a swing must be. Right Bars also sets the confirmation delay.
Liquidity Pools - lookback, cluster epsilon (how aggressively levels merge), minimum touches, age half-life, and whether volume contributes to the score.
Draw on Liquidity - proximity, structural prior strength, path clearance, the empirical-calibration toggle, and the calibration horizon.
Sweeps & Structure - sweep penetration, show sweeps, show structure, and the plain-language label toggle.
Order Blocks / FVG - show order blocks, show gaps, the order-block scan window, and the maximum number of boxes.
Visuals - colors for buy-side and sell-side liquidity, draw target, and structure, plus a minimum band height so pools read as bands rather than threads.
Multi-Timeframe HUD - show / hide the panel, the three higher timeframes, and panel position.
Markets and Timeframes
The indicator can be applied across multiple markets and timeframes:
Because the clustering distance, proximity kernel, and score are all ATR-based, the visual behavior stays consistent across instruments and timeframes. The volume component of the Liquidity Score contributes most on instruments with reliable volume (crypto, futures, equities) and falls back gracefully where volume is thin. The empirical hit-rate reads best on charts with enough history for its buckets to fill.
Alerts
All alerts evaluate on confirmed bars to avoid intra-bar oscillation.
This is a visual analytical tool intended for chart reading and liquidity mapping. It does not execute trades and does not provide financial advice. It does not generate buy or sell signals and makes no claim about profitability or win rate. The draw percentage describes how often similar pools were reached in the past over the loaded data; it is a descriptive statistic, not a prediction, and past behavior does not guarantee future results.
Key Features
- Resting liquidity drawn as density bands from ATR-normalized clustering of equal highs and lows, so nearby levels merge into one pool instead of a stack of lines
- Band brightness driven by a Liquidity Score that blends a saturating touch count, age decay, relative volume at the forming pivots, and rejection-wick depth
- Draw on Liquidity projection: a directional arrow to the pool with the strongest modelled pull, muted automatically when the model's confidence is low
- Draw percentage shown as a self-calibrating empirical hit-rate — how often pools of a similar profile were actually reached over the loaded history, marked provisional while the sample is thin
- Sweep detection when price wicks beyond the last significant swing and closes back within it, with recent sweeps labelled and older ones marked compactly
- Protected-swing structure engine marking Break of Structure and Change of Character, with an optional plain-language label mode
- Order blocks drawn only when they originate a Break of Structure, plus an optional Fair Value Gap layer; both fade once mitigated
- Multi-timeframe panel with chart and higher-timeframe bias, liquidity pull, draw target with its hit-rate, and pool counts, read non-repainting
Core Concept
Most liquidity and order-block tools on TradingView take one of two approaches. They either draw raw equal-high / equal-low lines and mark every order block and gap without ranking them, which clutters the chart and leaves the reader to judge which level matters, or they label structure (swings, breaks of structure) without projecting where liquidity is likely to pull price next. Both stop short of a scored, forward-looking read.
This indicator builds on a different base: cluster swing levels into scored density bands, gate order blocks by structure, and add a model for the next likely draw that is calibrated against realized history. It adds three specific algorithmic elements on top of that base.
1. ATR-Normalized Liquidity Clustering with a Multi-Factor Score. Swing highs and lows are not drawn as individual lines. They are grouped along the price axis by a clustering pass whose merge distance scales with ATR, so equal-ish levels collapse into a single pool and the behavior stays consistent across instruments. Each pool carries a Liquidity Score built multiplicatively from a saturating touch count, an age-decay term, relative volume at the forming pivots, and rejection-wick depth, so a band's brightness reflects how heavy and how fresh the resting liquidity is rather than only how many times the level was touched.
2. Draw on Liquidity Projection. Each unmitigated pool is treated as an attractor. Its pull is the product of its Liquidity Score, an exponential proximity kernel in ATR units, a structural prior that favors pools lying in the trend's continuation direction relative to current price, and a path-clearance term that discounts a pool when other strong pools sit between it and price. The strongest-pull pool is projected as the draw target, and the projection is deliberately muted when confidence is low, so a weak draw never reads like a strong one.
3. Self-Calibrating Empirical Hit-Rate. The draw percentage is not a fixed weight. Each draw is profiled into a bucket defined by Liquidity Score, distance, and structural alignment, and as the chart's history is processed the script records how often pools of that profile were actually reached within a configurable horizon. The displayed figure is the empirical reach frequency of that bucket, smoothed with a weak prior so thin samples are shown as provisional rather than over-read. It calibrates per symbol and timeframe with no fixed accuracy claim attached.
Anatomy of the Display
Liquidity bands are the horizontal zones spanning each pool, colored for buy-side (above) and sell-side (below) liquidity; the brighter a band, the higher its Liquidity Score. Swept pools dim to grey so a hunted level is visually retired.
The draw projection is the arrow from current price to the strongest-pull pool, with a price-side chip and an arrowhead pointing the modelled direction. Its weight scales with the hit-rate: a high-confidence draw is bold, a low-confidence one is thin and faded. The label reads the target level, the hit-rate (shown as a provisional `~NN% (n…)` while its sample is small), and whether the pool is buy-side or sell-side liquidity.
Sweeps mark a stop-hunt of the last significant swing: a wick beyond it that closes back within. The two most recent are labelled; older ones are compact marks so the chart stays clean.
Structure is drawn as Break of Structure and Change of Character lines from a protected-swing state machine; a toggle renders these in plain language (Trend break / Reversal) for readers new to the terminology.
Order blocks are the boxes drawn at the last opposite candle before a Break of Structure, so only structure-originating blocks appear; the optional Fair Value Gap layer marks three-candle imbalances aligned with the break. Both fade once price mitigates them.
The right-side panel lists chart structure, the net liquidity pull and its strength, the draw target with its hit-rate, pool counts per side, and a per-row higher-timeframe bias scan with a strength bar.
Multi-Timeframe Panel
The panel reads three higher timeframes of your choice for structural bias and trend strength, using the same protected-swing engine as the chart. Higher-timeframe values are read with `lookahead=barmerge.lookahead_off` and a one-bar offset, which is the standard non-repainting pattern for higher-timeframe context. A divergence between the chart's structure row and the liquidity pull is informative rather than contradictory: structure up while the draw points down with a high hit-rate, for example, frames an expected pullback toward a strong pool below.
Notes on Repainting
- Confirmed liquidity pools, sweeps, structure breaks, and order blocks do not repaint. They are built from confirmed pivots (`ta.pivothigh` and `ta.pivotlow` with a right-bars parameter), so once committed they stay anchored.
- Pivot detection has an inherent delay equal to the right-bars parameter (default 3 bars). The most recent swing is provisional until that many bars close past it. This is a property of all pivot-based indicators, not specific to this script.
- The draw percentage is a learning statistic. It updates as the script accumulates observations over the loaded history. This is not a repaint of historical bars; the same bar can show a different figure when the chart is reloaded with a different amount of history, because more or fewer observations are available.
- Mitigation is one-directional. Once an order block or gap is mitigated it stays marked as such.
- Multi-timeframe panel data uses `lookahead=barmerge.lookahead_off` with a one-bar offset, the canonical non-repainting pattern for higher-timeframe context.
- Alerts are gated by `barstate.isconfirmed` and fire once per closed bar, never intra-bar.
Typical Analysis Workflow
A common analytical workflow may include:
- Reading the band map to see where the heaviest resting liquidity sits above and below price, with brighter bands as the higher-quality pools
- Reading the draw projection as a hypothesis for where liquidity may pull price next, weighting it by its hit-rate and whether it aligns with structure
- Noting sweeps as stop-hunts that often precede a move, and watching whether price reclaims or rejects the swept level
- Treating order blocks as origin zones for the move that broke structure, and the panel's higher-timeframe rows as top-down context
- Reading a structure-versus-pull divergence as a possible pullback rather than a contradiction, then managing any decision with other forms of analysis and risk management
Configuration
Structure Engine - ATR length, pivot left / right bars, and the swing filter that sets how significant a swing must be. Right Bars also sets the confirmation delay.
Liquidity Pools - lookback, cluster epsilon (how aggressively levels merge), minimum touches, age half-life, and whether volume contributes to the score.
Draw on Liquidity - proximity, structural prior strength, path clearance, the empirical-calibration toggle, and the calibration horizon.
Sweeps & Structure - sweep penetration, show sweeps, show structure, and the plain-language label toggle.
Order Blocks / FVG - show order blocks, show gaps, the order-block scan window, and the maximum number of boxes.
Visuals - colors for buy-side and sell-side liquidity, draw target, and structure, plus a minimum band height so pools read as bands rather than threads.
Multi-Timeframe HUD - show / hide the panel, the three higher timeframes, and panel position.
Markets and Timeframes
The indicator can be applied across multiple markets and timeframes:
- Cryptocurrencies
- Forex
- Stocks and Indices
- Commodities
Because the clustering distance, proximity kernel, and score are all ATR-based, the visual behavior stays consistent across instruments and timeframes. The volume component of the Liquidity Score contributes most on instruments with reliable volume (crypto, futures, equities) and falls back gracefully where volume is thin. The empirical hit-rate reads best on charts with enough history for its buckets to fill.
Alerts
- Buy-side liquidity swept - fires when a buy-side pool's level is hunted
- Sell-side liquidity swept - fires when a sell-side pool's level is hunted
- Bullish Break of Structure - fires on a confirmed upside structure break
- Bearish Break of Structure - fires on a confirmed downside structure break
- All timeframes bullish - fires when every higher-timeframe row is bullish
- All timeframes bearish - fires when every higher-timeframe row is bearish
All alerts evaluate on confirmed bars to avoid intra-bar oscillation.
Açık kaynak kodlu komut dosyası
Gerçek TradingView ruhuyla, bu komut dosyasının mimarı, yatırımcıların işlevselliğini inceleyip doğrulayabilmesi için onu açık kaynaklı hale getirdi. Yazarı tebrik ederiz! Ücretsiz olarak kullanabilseniz de, kodu yeniden yayınlamanın Topluluk Kurallarımıza tabi olduğunu unutmayın.
📊 MQLSoftware — Premium TradingView indicators
🎯 Featured: Pro Swing Trading System | DisruptNEX Edge System
🌐 mqlsoftware.info
For educational purposes only.
🎯 Featured: Pro Swing Trading System | DisruptNEX Edge System
🌐 mqlsoftware.info
For educational purposes only.
Feragatname
Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, alım satım veya diğer türden tavsiye veya öneriler anlamına gelmez ve teşkil etmez. Kullanım Koşulları bölümünde daha fazlasını okuyun.
Açık kaynak kodlu komut dosyası
Gerçek TradingView ruhuyla, bu komut dosyasının mimarı, yatırımcıların işlevselliğini inceleyip doğrulayabilmesi için onu açık kaynaklı hale getirdi. Yazarı tebrik ederiz! Ücretsiz olarak kullanabilseniz de, kodu yeniden yayınlamanın Topluluk Kurallarımıza tabi olduğunu unutmayın.
📊 MQLSoftware — Premium TradingView indicators
🎯 Featured: Pro Swing Trading System | DisruptNEX Edge System
🌐 mqlsoftware.info
For educational purposes only.
🎯 Featured: Pro Swing Trading System | DisruptNEX Edge System
🌐 mqlsoftware.info
For educational purposes only.
Feragatname
Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, alım satım veya diğer türden tavsiye veya öneriler anlamına gelmez ve teşkil etmez. Kullanım Koşulları bölümünde daha fazlasını okuyun.