OPEN-SOURCE SCRIPT

Whale Fractal Levels (V1.0)

490
What it does

This indicator plots Fractal Levels (Bill Williams pivots) as horizontal lines and prints clean signals for:

BO+ / BO− → Breakouts through the latest fractal high/low

SW↑ / SW↓ → Liquidity sweeps (wick pierces, close rejects)

RE+ / RE− → Retests of the broken level after a confirmed breakout

Cyan = support (fractal lows).
Lilac = resistance (fractal highs).

How it works

Detects fractals with Left/Right = lr. A pivot is confirmed after lr bars on the right → the level itself doesn’t repaint.

Each confirmed fractal spawns a horizontal line extended to the right. You can limit how many lines stay on chart and auto-expire old ones.

Signals reference the most recent fractal high/low only and are edge-triggered (crossover/crossunder) with a cooldown so you don’t get a marker on every bar near the level.

A small state machine remembers the last breakout to validate the next retest.

Inputs (Settings)

Fractals

Left/Right (BW fractal) — Sensitivity of pivots (lower = more reactive, higher = cleaner).

MAX number of levels to display — Keep only the most recent N lines.

Level lifetime (bars) — Auto-delete lines after N bars to declutter.

Signals

Cooldown between signals (bars) — Minimum spacing between markers (anti-spam).

Show Breakouts (BO±) — Toggle breakout markers.

Show Sweeps (SW↑/SW↓) — Toggle sweep markers.

Show Retests (RE±) — Toggle retest markers.

Display

Show fractal lines / Line width / Line transparency (0..100)

Alerts (ready to use)

BO+ (Fractal), BO- (Fractal)

SW↑ (Fractal), SW↓ (Fractal)

RE+ (Fractal), RE- (Fractal)

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.