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
Open-source Skript
Ganz im Sinne von TradingView hat dieser Autor sein/ihr Script als Open-Source veröffentlicht. Auf diese Weise können nun auch andere Trader das Script rezensieren und die Funktionalität überprüfen. Vielen Dank an den Autor! Sie können das Script kostenlos verwenden, aber eine Wiederveröffentlichung des Codes unterliegt unseren Hausregeln.
Haftungsausschluss
Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.
Open-source Skript
Ganz im Sinne von TradingView hat dieser Autor sein/ihr Script als Open-Source veröffentlicht. Auf diese Weise können nun auch andere Trader das Script rezensieren und die Funktionalität überprüfen. Vielen Dank an den Autor! Sie können das Script kostenlos verwenden, aber eine Wiederveröffentlichung des Codes unterliegt unseren Hausregeln.
Haftungsausschluss
Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.