OPEN-SOURCE SCRIPT
Institutional Liquidity Sweep [PickMyTrade]

Institutional Liquidity Sweep [PickMyTrade] identifies institutional stop-hunt reversals by measuring five structural microstructure factors at every confirmed swing-level sweep and combining them into a single, readable Confluence Score. When the score clears a configurable threshold — and the sweep aligns with an active Order Block — the indicator fires a directional signal with a score label, an SL/TP projection, and an auto-mitigating OB zone on the chart.
Unlike fixed-threshold crossover tools, this indicator does not assume that every wick below a swing low or above a swing high is meaningful. It asks a structural question instead: given the depth of the sweep, the absorption shown in order flow, the session timing, and whether an institutional Order Block was sitting at that level — how strong is the reversal case? Five factors answer that question and a weighted score between 0 and 100 summarises the result on every bar.
────────────────────────────────────────────────────────
🔷 WHAT IT MEASURES
🔸 Swing-Level Sweep Detection
A bullish sweep is confirmed when the current bar's wick pierces the N-bar swing low while the close returns above it. A bearish sweep is the mirror: wick above the swing high, close back below. The swing level uses a confirmed lookback — no current-bar values enter the swing calculation — making the sweep detection fully non-repainting. This single structural requirement gates the entire indicator: the five factors and the Order Block check only matter on a bar that has already swept a swing level.
🔸 F1 — Wick Rejection Purity (weight 28%)
How much of the sweep wick was recovered within the same bar? A bar that sweeps 20 points below the swing low but closes only 2 points above it has poor rejection. A bar that sweeps 20 points and closes back near the top of its range has high rejection purity. This factor is z-score normalised over a rolling window so that the same numeric value carries the same weight regardless of instrument volatility.
🔸 F2 — Volume Participation (weight 20%)
Volume at the sweep bar is z-score normalised against recent history. Elevated volume confirms institutional participation: a stop hunt that clears retail orders but attracts heavy buy (sell) pressure is more likely to reverse than one with below-average volume. A sweep on thin volume gets a low F2 score even if the rejection wick looks clean.
🔸 F3 — CVD Net Absorption (weight 25%)
Cumulative volume delta tracks the net order flow direction using the close-position formulaPine Script® . The single-bar delta at the sweep bar is z-score normalised and sign-adjusted: a bullish sweep wants a positive delta (buyers absorbed the down-spike); a bearish sweep wants a negative delta (sellers absorbed the up-spike). When order flow and price action agree on the reversal, F3 scores high. When they disagree — price sweeps down but sellers are still dominant — F3 penalises the composite score.
🔸 F4 — Structural Recovery (weight 17%)
How far did the close reclaim the swept swing level relative to the depth of the sweep? If a bar sweeps 30 points below the swing low and closes 25 points above it, recovery is strong. If it closes only 2 points above the swing level having swept 30 points, recovery is weak. This factor rewards bars that decisively reclaim the institutional level rather than barely scratching back above it.
🔸 F5 — Session Window (weight 10%)
Liquidity events during the London open (07:00–10:00 UTC by default) and the New York open (13:00–16:00 UTC by default) carry a higher institutional weight than off-peak sweeps. This factor scores 1.0 during the London window, 0.85 during the NY window, and 0.45 at all other times. Session hours are configurable in UTC and the session windows are highlighted on the chart.
────────────────────────────────────────────────────────
🔷 THE COMPOSITE SCORE
Each factor is normalised to a 0–1 scale using z-score transformation. The five normalised scores are then combined with the weights above into a single composite score from 0 to 100:
Score = (0.28 × F1 + 0.20 × F2 + 0.25 × F3 + 0.17 × F4 + 0.10 × F5) × 100
An Order Block alignment bonus (configurable, default 15 points) is added on top when the sweep level coincides with an active OB zone, with the score capped at 100. The threshold (default 65) is the minimum score required to fire a signal. Raising the threshold to 75–80 restricts signals to the highest-conviction sweeps; lowering it to 50 produces more signals on weaker structure.
────────────────────────────────────────────────────────
🔷 ORDER BLOCKS
🔸 Detection
A bullish Order Block is the last bearish candle before a sequence of N consecutive bullish candles (an upside impulse). A bearish Order Block is the last bullish candle before N consecutive bearish candles (a downside impulse). The impulse candle count is configurable (default 3). Only confirmed, closed bars enter the OB detection — no current-bar data is used.
🔸 Zones
Each active OB is drawn as a persistent price zone box extending from the OB candle's high to its low. Bull OB zones use the bull colour; bear OB zones use the bear colour. When a new OB forms, the previous OB of the same direction is replaced. The right edge of each box extends bar-by-bar until mitigated.
🔸 Mitigation
A bull OB is mitigated when price closes below the bottom of the zone. A bear OB is mitigated when price closes above the top. On mitigation the box is deleted and the zone is deregistered. The info table shows "Aligned" when the sweep level currently sits inside an active OB zone, "Active" when an OB exists but is not being swept, and "None" when no OB is registered.
🔸 Score Bonus
When a sweep aligns with an active OB — meaning the swept swing level falls within the OB zone's price range — the composite score receives the OB bonus. This reflects the structural significance of a sweep-and-reversal occurring at a previously identified institutional reference level.
────────────────────────────────────────────────────────
🔷 SESSION WINDOWS
London and New York open windows are highlighted on the chart as faint background tints (yellow for London, teal for NY). These are the hours during which institutional desks are most active and liquidity sweep events are most frequently observed. Session highlighting can be toggled off independently of the session weight applied to F5.
────────────────────────────────────────────────────────
🔷 SIGNAL LOGIC
A long signal fires when three conditions are simultaneously true on the same bar:
A short signal fires under the symmetric conditions using the swing high and requiring price to be below the EMA. The signal is edge-triggered — it fires once on the first qualifying bar and resets when conditions are no longer met. The signal label shows "ILS" followed by the rounded score (e.g. ILS 72).
────────────────────────────────────────────────────────
🔷 HOW TO READ IT
🔸 Confluence Pressure Band
A fill band extends from the trend EMA to ±1 ATR. The opacity of the fill scales continuously with the composite score — a faint band indicates a low-scoring environment; a deep saturated band indicates a high-scoring environment even before a sweep fires.
🔸 Entry Shapes
Circles indicate high-conviction signals (score ≥ 80); triangles indicate standard signals (score ≥ threshold). The shape appears at the sweep bar with a score label. Shapes are coloured at full intensity for high conviction and at 75% opacity for standard signals.
🔸 OB Zone Boxes
Semi-transparent filled boxes mark active Order Block zones. They extend to the right on every bar until mitigated by a close through the zone boundary. When a sweep lands inside a box, the OB bonus is added to the score at that moment.
🔸 Session Highlights
Faint yellow and teal background tints mark London and NY open windows respectively. Sweeps outside both windows score lower on F5 and require the other four factors to compensate.
🔸 Info Table
The top-right table shows seven live values at every bar: the composite score, all five normalised factor scores (0–1), the active session, and the OB zone status. Factor scores above 0.60 are highlighted in lime green.
🔸 SL / TP Lines
Dashed red and green lines mark the ATR-based stop loss and take profit levels at each signal bar. The SL is placed beyond the sweep wick by a configurable ATR multiple; the TP is set at the SL distance multiplied by the risk:reward ratio. Both lines extend 8 bars to the right and do not repaint.
────────────────────────────────────────────────────────
🔷 INPUTS
🔸 Sweep Detection
🔸 Confluence Score
🔸 Order Blocks
🔸 Session Windows
🔸 Signal Levels
🔸 Visual / Display
────────────────────────────────────────────────────────
🔷 REQUIREMENTS AND LIMITATIONS
The indicator requires a minimum of Normalisation Window bars before z-score statistics are meaningful. On short-history charts or when first applied, z-scores will be zero and the score will rely primarily on F5 (session timing).
CVD is estimated from the close-position formula — a synthetic approximation of net order flow, not true bid/ask volume. On illiquid instruments or timeframes where intrabar price travel is minimal, the CVD delta is noisy and F3 will contribute less discriminative power.
Order Block detection uses a simplified impulse model (N consecutive same-direction closes). The single-active-OB-per-direction design is intentional: the indicator tracks the most recent OB, not a full library of zones.
Session timing is meaningful on intraday timeframes (15M through 4H). On daily or weekly charts, F5 will score at its off-peak value — toggle off session highlights on higher timeframes.
The composite score is a relative measure, not an absolute probability. A score of 72 means the current sweep bar shows strong structural confluence relative to normalised distributions — it does not imply a 72% probability of reversal.
────────────────────────────────────────────────────────
Built natively in Pine Script® v6. Five-factor confluence scoring using z-score normalisation with rolling statistics, non-repainting swing-level sweep detection, auto-mitigating Order Block zones, and session-weighted structural analysis. No external libraries, no data feeds, no fixed lookback arrays.
Open source — Mozilla Public License 2.0. Published by PickMyTrade_Official.
Unlike fixed-threshold crossover tools, this indicator does not assume that every wick below a swing low or above a swing high is meaningful. It asks a structural question instead: given the depth of the sweep, the absorption shown in order flow, the session timing, and whether an institutional Order Block was sitting at that level — how strong is the reversal case? Five factors answer that question and a weighted score between 0 and 100 summarises the result on every bar.
────────────────────────────────────────────────────────
🔷 WHAT IT MEASURES
🔸 Swing-Level Sweep Detection
A bullish sweep is confirmed when the current bar's wick pierces the N-bar swing low while the close returns above it. A bearish sweep is the mirror: wick above the swing high, close back below. The swing level uses a confirmed lookback — no current-bar values enter the swing calculation — making the sweep detection fully non-repainting. This single structural requirement gates the entire indicator: the five factors and the Order Block check only matter on a bar that has already swept a swing level.
🔸 F1 — Wick Rejection Purity (weight 28%)
How much of the sweep wick was recovered within the same bar? A bar that sweeps 20 points below the swing low but closes only 2 points above it has poor rejection. A bar that sweeps 20 points and closes back near the top of its range has high rejection purity. This factor is z-score normalised over a rolling window so that the same numeric value carries the same weight regardless of instrument volatility.
🔸 F2 — Volume Participation (weight 20%)
Volume at the sweep bar is z-score normalised against recent history. Elevated volume confirms institutional participation: a stop hunt that clears retail orders but attracts heavy buy (sell) pressure is more likely to reverse than one with below-average volume. A sweep on thin volume gets a low F2 score even if the rejection wick looks clean.
🔸 F3 — CVD Net Absorption (weight 25%)
Cumulative volume delta tracks the net order flow direction using the close-position formula
🔸 F4 — Structural Recovery (weight 17%)
How far did the close reclaim the swept swing level relative to the depth of the sweep? If a bar sweeps 30 points below the swing low and closes 25 points above it, recovery is strong. If it closes only 2 points above the swing level having swept 30 points, recovery is weak. This factor rewards bars that decisively reclaim the institutional level rather than barely scratching back above it.
🔸 F5 — Session Window (weight 10%)
Liquidity events during the London open (07:00–10:00 UTC by default) and the New York open (13:00–16:00 UTC by default) carry a higher institutional weight than off-peak sweeps. This factor scores 1.0 during the London window, 0.85 during the NY window, and 0.45 at all other times. Session hours are configurable in UTC and the session windows are highlighted on the chart.
────────────────────────────────────────────────────────
🔷 THE COMPOSITE SCORE
Each factor is normalised to a 0–1 scale using z-score transformation. The five normalised scores are then combined with the weights above into a single composite score from 0 to 100:
Score = (0.28 × F1 + 0.20 × F2 + 0.25 × F3 + 0.17 × F4 + 0.10 × F5) × 100
An Order Block alignment bonus (configurable, default 15 points) is added on top when the sweep level coincides with an active OB zone, with the score capped at 100. The threshold (default 65) is the minimum score required to fire a signal. Raising the threshold to 75–80 restricts signals to the highest-conviction sweeps; lowering it to 50 produces more signals on weaker structure.
────────────────────────────────────────────────────────
🔷 ORDER BLOCKS
🔸 Detection
A bullish Order Block is the last bearish candle before a sequence of N consecutive bullish candles (an upside impulse). A bearish Order Block is the last bullish candle before N consecutive bearish candles (a downside impulse). The impulse candle count is configurable (default 3). Only confirmed, closed bars enter the OB detection — no current-bar data is used.
🔸 Zones
Each active OB is drawn as a persistent price zone box extending from the OB candle's high to its low. Bull OB zones use the bull colour; bear OB zones use the bear colour. When a new OB forms, the previous OB of the same direction is replaced. The right edge of each box extends bar-by-bar until mitigated.
🔸 Mitigation
A bull OB is mitigated when price closes below the bottom of the zone. A bear OB is mitigated when price closes above the top. On mitigation the box is deleted and the zone is deregistered. The info table shows "Aligned" when the sweep level currently sits inside an active OB zone, "Active" when an OB exists but is not being swept, and "None" when no OB is registered.
🔸 Score Bonus
When a sweep aligns with an active OB — meaning the swept swing level falls within the OB zone's price range — the composite score receives the OB bonus. This reflects the structural significance of a sweep-and-reversal occurring at a previously identified institutional reference level.
────────────────────────────────────────────────────────
🔷 SESSION WINDOWS
London and New York open windows are highlighted on the chart as faint background tints (yellow for London, teal for NY). These are the hours during which institutional desks are most active and liquidity sweep events are most frequently observed. Session highlighting can be toggled off independently of the session weight applied to F5.
────────────────────────────────────────────────────────
🔷 SIGNAL LOGIC
A long signal fires when three conditions are simultaneously true on the same bar:
- A bullish sweep is detected (wick below the N-bar swing low, close above it)
- The composite score meets or exceeds the threshold
- Price is above the trend EMA (macro direction filter)
A short signal fires under the symmetric conditions using the swing high and requiring price to be below the EMA. The signal is edge-triggered — it fires once on the first qualifying bar and resets when conditions are no longer met. The signal label shows "ILS" followed by the rounded score (e.g. ILS 72).
────────────────────────────────────────────────────────
🔷 HOW TO READ IT
🔸 Confluence Pressure Band
A fill band extends from the trend EMA to ±1 ATR. The opacity of the fill scales continuously with the composite score — a faint band indicates a low-scoring environment; a deep saturated band indicates a high-scoring environment even before a sweep fires.
🔸 Entry Shapes
Circles indicate high-conviction signals (score ≥ 80); triangles indicate standard signals (score ≥ threshold). The shape appears at the sweep bar with a score label. Shapes are coloured at full intensity for high conviction and at 75% opacity for standard signals.
🔸 OB Zone Boxes
Semi-transparent filled boxes mark active Order Block zones. They extend to the right on every bar until mitigated by a close through the zone boundary. When a sweep lands inside a box, the OB bonus is added to the score at that moment.
🔸 Session Highlights
Faint yellow and teal background tints mark London and NY open windows respectively. Sweeps outside both windows score lower on F5 and require the other four factors to compensate.
🔸 Info Table
The top-right table shows seven live values at every bar: the composite score, all five normalised factor scores (0–1), the active session, and the OB zone status. Factor scores above 0.60 are highlighted in lime green.
🔸 SL / TP Lines
Dashed red and green lines mark the ATR-based stop loss and take profit levels at each signal bar. The SL is placed beyond the sweep wick by a configurable ATR multiple; the TP is set at the SL distance multiplied by the risk:reward ratio. Both lines extend 8 bars to the right and do not repaint.
────────────────────────────────────────────────────────
🔷 INPUTS
🔸 Sweep Detection
- Swing Lookback — N-bar window defining the swing high/low that must be swept. Default 20.
🔸 Confluence Score
- Score Threshold — minimum composite score (0–100) to fire a signal. Default 65.
- Normalisation Window — rolling window for z-score normalisation. Default 50.
- Order Block Score Bonus — additional points when sweep aligns with an OB zone. Default 15.
🔸 Order Blocks
- Show OB Zones — toggle OB box drawing.
- Impulse Candles Required — consecutive same-direction candles to identify an impulse. Default 3.
🔸 Session Windows
- Show Session Highlights — toggle background session tints.
- Chart Timezone — must match your chart timezone for accurate session hour detection.
- London Open Hour / NY Open Hour — start of each window in UTC. Defaults: London 7, NY 13.
- Window Width — hours each session window spans. Default 3.
🔸 Signal Levels
- Show SL / TP Lines — toggle projection lines.
- SL ATR Multiplier — stop loss distance as ATR multiple. Default 1.5.
- Risk : Reward — TP as a multiple of the SL distance. Default 2.0.
- ATR Period — Default 14.
- Trend EMA Period — macro direction filter. Default 50.
🔸 Visual / Display
- Bull / Bear Colour — base colours for all directional elements.
- Confluence Pressure Band — toggle the EMA fill band.
- Zen Mode — hides all text labels; only shapes and zones remain.
- Show Info Table — toggle the top-right factor breakdown table.
────────────────────────────────────────────────────────
🔷 REQUIREMENTS AND LIMITATIONS
The indicator requires a minimum of Normalisation Window bars before z-score statistics are meaningful. On short-history charts or when first applied, z-scores will be zero and the score will rely primarily on F5 (session timing).
CVD is estimated from the close-position formula — a synthetic approximation of net order flow, not true bid/ask volume. On illiquid instruments or timeframes where intrabar price travel is minimal, the CVD delta is noisy and F3 will contribute less discriminative power.
Order Block detection uses a simplified impulse model (N consecutive same-direction closes). The single-active-OB-per-direction design is intentional: the indicator tracks the most recent OB, not a full library of zones.
Session timing is meaningful on intraday timeframes (15M through 4H). On daily or weekly charts, F5 will score at its off-peak value — toggle off session highlights on higher timeframes.
The composite score is a relative measure, not an absolute probability. A score of 72 means the current sweep bar shows strong structural confluence relative to normalised distributions — it does not imply a 72% probability of reversal.
────────────────────────────────────────────────────────
Built natively in Pine Script® v6. Five-factor confluence scoring using z-score normalisation with rolling statistics, non-repainting swing-level sweep detection, auto-mitigating Order Block zones, and session-weighted structural analysis. No external libraries, no data feeds, no fixed lookback arrays.
Open source — Mozilla Public License 2.0. Published by PickMyTrade_Official.
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
Automate TradingView alerts to brokers no coding needed. Trade futures, forex, or crypto, copy trades across unlimited accounts, & control risk with ease.
For Tradovate: bit.ly/4a1KBrY
For all other supported brokers: bit.ly/4qEbU2G
For Tradovate: bit.ly/4a1KBrY
For all other supported brokers: bit.ly/4qEbU2G
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
Automate TradingView alerts to brokers no coding needed. Trade futures, forex, or crypto, copy trades across unlimited accounts, & control risk with ease.
For Tradovate: bit.ly/4a1KBrY
For all other supported brokers: bit.ly/4qEbU2G
For Tradovate: bit.ly/4a1KBrY
For all other supported brokers: bit.ly/4qEbU2G
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน