OPEN-SOURCE SCRIPT

Liquidity Sweep Reversal [forexobroker]

557
Liquidity Sweep Reversal [forexobroker] detects stop-hunt sweeps: price wicks past a confirmed swing extreme to grab resting liquidity but the bar closes back inside, trapping breakout traders. The unique angle is ATR-scaled depth bounds (a minimum to filter noise and a maximum to reject genuine breaks) plus a persistent reversal bias armed by the sweep, with entries timed on an EMA reclaim instead of only the rarer classic sweep bar.

🔶 ALGORITHM

1. Confirm swing structure with symmetric pivots (ta.pivothigh / ta.pivotlow), tracking the latest confirmed swing high and swing low.
2. Detect a bullish sweep: low pierces the swing low by at least Min Sweep Depth x ATR but no more than Max Sweep Depth x ATR, and close finishes back above the swing low (optionally requiring a bullish reversal body). Bearish sweep is the mirror.
3. The maximum-depth bound rejects runaway moves that are real breaks rather than stop hunts.
4. Persistent reversal bias: a bullish sweep arms bias +1, a bearish sweep arms bias -1, holding until the opposite side sweeps.
5. Entry timing: within an active sweep bias, an EMA reclaim (ta.crossover / ta.crossunder of close vs the Entry Reclaim EMA) fires the trade. Sweep-Only Mode swaps this for the strict sweep+reclaim bar.

🔶 SIGNAL LOGIC

- Buy: bullish sweep bias active (swing low swept and reclaimed) and close crosses over the Entry Reclaim EMA (or, in Sweep-Only Mode, the sweep bar itself), in session, position not already long, after the cooldown window, only on barstate.isconfirmed; position-lock flips to LONG.
- Sell: bearish sweep bias active (swing high swept and reclaimed) and close crosses under the Entry Reclaim EMA (or the sweep bar itself), in session, position not already short, cooldown elapsed, on barstate.isconfirmed; position-lock flips to SHORT.
Only fires when a confirmed sweep has armed the matching reversal bias.

🔶 INPUTS

- Liquidity: pivot length for swing confirmation (default 6) and ATR length.
- Sweep depth: minimum sweep depth in ATR multiples (default 0.20x ATR) and maximum sweep depth to reject real breaks (default 3.0x ATR).
- Reclaim validity: reclaim-within-bars window and require-reversal-body toggle (default on).
- Signal Logic: Entry Reclaim EMA length (default 9) and Sweep-Only Mode toggle (default off).
- Cooldown: minimum bars between signals (default 5).
- Filters: optional session restriction with a session window.
- Visual: swept-level lines, dashboard, 3-layer glow, buy/sell colors, dashboard background.

🔶 ALERTS

LSR Buy, LSR Sell, LSR Any Signal, LSR Low Swept, LSR High Swept, LSR New Swing High, LSR New Swing Low, LSR Low Pierce, LSR High Pierce, LSR Any Sweep, LSR Sweep Tick, LSR Strong Bull, LSR Webhook JSON.

🔶 LIMITATIONS

- Requires warm-up: pivots confirm only after Pivot Length bars on each side, so early history produces no sweep targets.
- Defaults (ATR 14, min 0.20x, max 3.0x) are tuned for liquid instruments; volatile or thin symbols may need wider depth bounds.
- Sweep-Only Mode is intentionally rare; the default EMA-reclaim regime mode trades more frequently.
- Non-repainting by design (pivots confirmed, signal on bar close); the swing being swept appears Pivot Length bars after it formed.
- A sweep is a probabilistic trap, not a guaranteed reversal; in strong trends a level can be swept and continue rather than reverse.

คำจำกัดสิทธิ์ความรับผิดชอบ

ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน