OPEN-SOURCE SCRIPT

Sweep + BOS (Lines + First Confirmed Only)

196
🔍 Indicator: Sweep + BOS (Break of Structure with Visual Lines)
🧠 Overview
This indicator combines Swing detection, Liquidity Sweeps, and Break of Structure (BOS) logic, with:

Customizable swing length,

BOS signals only after confirmed sweeps,

BOS shown only once per sweep,

Visual labels and connecting lines to highlight structure breaks clearly.

⚙️ Inputs
Swing Length:
Defines how many candles to use to identify a swing high/low. Must be an odd number (e.g., 3, 5, 7...).

Sweep Lookback Window:
Sets how far back the script checks for a sweep (false breakout over a swing).

BOS Validity After Sweep:
Number of bars within which a BOS can be considered valid after a sweep.

Toggle Options:
Show/hide:

Swing Labels

Sweep Labels

BOS Labels

BOS Connecting Lines

📌 Logic Breakdown
✅ Swings
Swing High: A candle’s high is greater than the highs of all N candles on both sides.

Swing Low: A candle’s low is lower than the lows of all N candles on both sides.

💧 Liquidity Sweeps
Sweep High:

Price spikes above a previous Swing High,

Then closes back below it (false breakout).

Sweep Low:

Price drops below a previous Swing Low,

Then closes back above it.

🔁 Break of Structure (BOS)
A BOS is only shown if:

It occurs after a valid sweep (within X bars),

It hasn’t been already plotted for that sweep,

BOS ↑ is only possible after Sweep Low,

BOS ↓ is only possible after Sweep High,

Opposite BOS type resets the last BOS state.

BOS ↑ (Bullish):

Confirmed when price closes above previous Swing High after Sweep Low.

Label appears at the candle low.

A line is drawn from the Swing Low to the BOS candle.

BOS ↓ (Bearish):

Confirmed when price closes below previous Swing Low after Sweep High.

Label appears at the candle high.

A line is drawn from the Swing High to the BOS candle.

Feragatname

Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, işlem veya diğer türden tavsiye veya tavsiyeler anlamına gelmez ve teşkil etmez. Kullanım Şartları'nda daha fazlasını okuyun.