OPEN-SOURCE SCRIPT

Sweep Retest Reversal

9 808
Title: Sweep Retest Reversal

Description:

This indicator detects a two-candle liquidity sweep reversal pattern and tracks the resulting retest level until it is either confirmed with a bounce or invalidated.

BULLISH SETUP:
A bearish candle (body >= X% of its range, configurable) is followed by a bullish candle (same body filter) whose low sweeps below the bearish candle's low, and whose close finishes above the bearish candle's open. When this occurs, a horizontal line is drawn at the swept low. That level remains active and is monitored on every subsequent bar:
- If a future candle's low touches the line and that same candle closes above it, the bounce is confirmed (green "Bounce" label) and the line is removed.
- If a future candle's low touches the line but closes at or below it, the setup is invalidated on that same bar and the line is removed without a label.

BEARISH SETUP (mirror logic):
A bullish candle is followed by a bearish candle whose high sweeps above the bullish candle's high, and whose close finishes below the bullish candle's open. A horizontal line is drawn at the swept high and monitored the same way:
- A future candle's high touching the line with a close below it confirms the bounce (red "Bounce" label).
- A touch with a close at or above the line invalidates the setup silently.

HOW TO INTERPRET IT:
The two-candle sequence represents a liquidity sweep: the first candle establishes a level, and the second candle pierces through it with its wick while closing back on the opposite side of the first candle's open. This signals that stops resting beyond that level were likely triggered and absorbed, leaving the swept point as a level worth watching again. The line marks that exact point. Price is expected to return to it at some later time. What happens on that return matters more than the touch itself: a wick that pokes through but a close that snaps back in the sweep's original direction supports the reversal thesis (confirmed bounce). A close that pushes through and stays there suggests the level failed to hold and the setup should be discarded (invalidation).

HOW TO USE IT:
1. Wait for the pattern to print: an orange triangle (bullish) or purple triangle (bearish) marks the bar where the sweep candle closed.
2. Once a line appears, treat it as an active level to watch — do not act on it yet, since it has not been retested.
3. When price returns to the line, watch how that specific candle closes:
- Bullish line + candle closes above it -> bounce confirmed, label appears. This is the point of interest for a potential long reaction.
- Bearish line + candle closes below it -> bounce confirmed, label appears. This is the point of interest for a potential short reaction.
- Any touch that closes on the wrong side invalidates the line immediately and it disappears with no label — that level is no longer relevant.
4. The indicator only flags the level and its resolution; it does not place entries, stops, or targets. Combine the confirmed bounce with your own entry, stop, and target rules (e.g. your existing Fibonacci stop-liquidity zone and 1:2 management) for actual trade execution.
5. Adjust the Min Body/Range Ratio input to control how strict the "big body" filter is — lower values surface more setups (including weaker ones), higher values restrict it to cleaner, more decisive sweep candles.

INPUTS:
- Min Body/Range Ratio (%): minimum body-to-range percentage required for both candles in the pattern (default 50%).
- Bullish/Bearish Retest Line Color: line color for each setup type.
- Bullish/Bearish Bounce Label Color: label color for each confirmed bounce.
- Show Bullish Pattern / Show Bearish Pattern: toggle each setup independently.

VISUAL MARKERS:
- Orange upward triangle below the bar: bullish pattern detected.
- Purple downward triangle above the bar: bearish pattern detected.
- Green "Bounce" label: confirmed bullish bounce.
- Red "Bounce" label: confirmed bearish bounce.

NOTES:
Each retest line resolves on the first touch - either confirming or invalidating immediately on that bar, never lingering across multiple touches. This keeps the chart clean and ensures every line on the chart represents a level that is still actively awaited.

Pernyataan Penyangkalan

Informasi dan publikasi ini tidak dimaksudkan, dan bukan merupakan, saran atau rekomendasi keuangan, investasi, trading, atau jenis lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Ketentuan Penggunaan.