OPEN-SOURCE SCRIPT
Liquidity Sweep Probability

Stop-hunt detection with dynamic zone rendering and statistical edge validation
Identifies liquidity sweeps — moments when price briefly wicks beyond a significant high or low, clears resting stop orders, then reverses sharply back inside. Tracks whether each sweep type has historically produced a follow-through move and highlights the 3 most contextually relevant zones based on what is currently visible on your chart.
Sweep detection
A sweep is confirmed when:
Price wicks beyond the highest high or lowest low of the previous N bars by at least min_pts
The bar closes back inside that level
The wick represents stop orders being triggered (the liquidity grab). The close back inside confirms the reversal has begun.
Dynamic zone rendering
Rather than cluttering the chart with every historical sweep, the indicator identifies the 3 most recent sweep events within your current visible chart window and renders only those as blue horizontal zones. As you scroll or zoom, the zones update automatically to reflect the 3 most recent events in view. The zone spans the swept price range (wick extreme to close) and extends forward by a configurable number of bars.
Post-sweep confluence
After a sweep, two additional patterns are tracked:
Fair Value Gap (FVG) — a 3-candle price imbalance forming in the reversal direction while the scoring window is active. Represents unfilled price inefficiency that may act as support or resistance. Shown as dashed purple zones, also limited to 3 most recent in view.
Gap B — a traditional price gap where the bar opens completely beyond the previous bar's extreme. Rarer on MGC due to near-24-hour trading, but meaningful when it occurs around the 6 PM session open.
Statistical confidence
The same probability engine used across the suite: uncapped wins/total observation counts feed the binomial z-score and t-test. Zones are only rendered when the binomial z-score exceeds the significance threshold (default 1.282, p < 0.10). The dashboard shows both the all-history probability and the recent-3 probability, with dual display triggered automatically when they diverge by 10 percentage points or more.
Inputs
Level lookback (bars defining the significant high/low)
Minimum sweep size in points
Reversal window (minutes) and threshold (points)
Significance threshold for zone display
Zone width and transparency
FVG and Gap B toggles
Identifies liquidity sweeps — moments when price briefly wicks beyond a significant high or low, clears resting stop orders, then reverses sharply back inside. Tracks whether each sweep type has historically produced a follow-through move and highlights the 3 most contextually relevant zones based on what is currently visible on your chart.
Sweep detection
A sweep is confirmed when:
Price wicks beyond the highest high or lowest low of the previous N bars by at least min_pts
The bar closes back inside that level
The wick represents stop orders being triggered (the liquidity grab). The close back inside confirms the reversal has begun.
Dynamic zone rendering
Rather than cluttering the chart with every historical sweep, the indicator identifies the 3 most recent sweep events within your current visible chart window and renders only those as blue horizontal zones. As you scroll or zoom, the zones update automatically to reflect the 3 most recent events in view. The zone spans the swept price range (wick extreme to close) and extends forward by a configurable number of bars.
Post-sweep confluence
After a sweep, two additional patterns are tracked:
Fair Value Gap (FVG) — a 3-candle price imbalance forming in the reversal direction while the scoring window is active. Represents unfilled price inefficiency that may act as support or resistance. Shown as dashed purple zones, also limited to 3 most recent in view.
Gap B — a traditional price gap where the bar opens completely beyond the previous bar's extreme. Rarer on MGC due to near-24-hour trading, but meaningful when it occurs around the 6 PM session open.
Statistical confidence
The same probability engine used across the suite: uncapped wins/total observation counts feed the binomial z-score and t-test. Zones are only rendered when the binomial z-score exceeds the significance threshold (default 1.282, p < 0.10). The dashboard shows both the all-history probability and the recent-3 probability, with dual display triggered automatically when they diverge by 10 percentage points or more.
Inputs
Level lookback (bars defining the significant high/low)
Minimum sweep size in points
Reversal window (minutes) and threshold (points)
Significance threshold for zone display
Zone width and transparency
FVG and Gap B toggles
開源腳本
秉持TradingView一貫精神,這個腳本的創作者將其設為開源,以便交易者檢視並驗證其功能。向作者致敬!您可以免費使用此腳本,但請注意,重新發佈代碼需遵守我們的社群規範。
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。
開源腳本
秉持TradingView一貫精神,這個腳本的創作者將其設為開源,以便交易者檢視並驗證其功能。向作者致敬!您可以免費使用此腳本,但請注意,重新發佈代碼需遵守我們的社群規範。
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。