OPEN-SOURCE SCRIPT

ICT Confluence Framework[BullByte]

16 609
ICT Confluence Framework is a structural price-action engine that monitors the chart for five independent ICT-style behaviors and fires a directional setup only when several of them align inside a short structural window. Designed for intraday traders on 1m–15m charts in crypto, indices, and futures, with an auto-adapter that rescales every meaningful lookback to the chart timeframe.

Most ICT tools draw one element - order blocks, liquidity pools, BOS lines - and leave the trader to combine them mentally. This framework does the combining, scores the result against the current market regime and volatility phase, and prints one clean setup with an Entry, two Reference Levels, and an Invalidation level. The chart stays focused on what is currently relevant - no permanent boxes, no arrows on every candle, no flashing icons.

WHY THIS IS NOT A MASHUP

No public indicator is imported, wrapped, or re-skinned. Every detector is written from first principles against raw OHLCV. The five detectors share four custom layers that no single public indicator provides:

- A common confluence scoring layer with adaptive per-pattern weighting
- A regime classifier based on path efficiency
- A volatility-phase filter based on rolling ATR percentile rank
- A signal lifecycle manager with deterministic outcome resolution

The originality is in how five orthogonal behaviors are unified into one decision - not in the behaviors themselves.

THE FIVE BEHAVIORS MONITORED

1. Liquidity Sweep + Reclaim
Price violates a recent swing extreme - taking out resting stops - then closes back inside the prior range within a short window. The classic stop-hunt-then-reverse footprint.

2. Stopping Volume
A high-volume bar at a local extreme that closes with a strong rejection wick. Marks a level where aggressive flow was absorbed by passive flow.

3. Range Compression to Expansion
A bar that is the narrowest of its recent window is immediately followed by an expansion bar of meaningful size. A bullish expansion contributes to a bullish setup; a bearish expansion to a bearish one.

4. Break of Structure (BOS)
A close beyond the last confirmed pivot high or low. The script uses 3-bar right-confirmed pivots, so BOS prints with structural lag by design - this removes false breaks.

5. Order Block Mitigation
Price returns to the last opposing candle preceding a strong impulse, wicks into it, and closes back outside the zone.

Each behavior is detected independently against raw price and volume.

WHY THESE FIVE

At structural turning points markets do a small number of distinct things: they trap traders (sweep), they absorb flow (stopping volume), they release energy (compression-expansion), they confirm intent (BOS), and they retest origin (order block). When two or more of these align within the same structural window on the same side, the setup quality is materially higher than any one of them in isolation.

WHAT MAKES THIS DIFFERENT

Signals are stable. Detection and signal arming occur only on confirmed bar close. Once a setup prints, it does not move, redraw, or vanish on the next tick.

The script adapts to your chart. Every pattern carries a rolling reliability score calculated from its own follow-through history on the instrument and timeframe you are viewing. Follow-through is measured as maximum favorable excursion in ATR multiples over a configurable evaluation window. Patterns that have been working get more weight; patterns that have been failing get less, bounded by a user-set floor so no pattern is fully silenced.

Market regime is respected. An efficiency ratio (net displacement divided by path length) classifies the market as Trend Up, Trend Down, Range, Volatile, or Neutral. Inside this classification, BOS in a Range is soft-weighted to 0.4x and Expansion in a Volatile regime is soft-weighted to 0.5x. Counter-trend setups inside a strong trend are weighted down to 0.5x but still allowed.

Volatility phase aware. The current ATR's percentile rank classifies the bar as Quiet, Normal, or Active. Active phase tightens the required pattern count by one (capped at five). Quiet and Normal use the user's setting unchanged.

Confluence decay. A residual opposing score decays linearly by 1.0 per bar with no fresh pattern activity, so a stale opposing cluster cannot block a fresh signal indefinitely. The decayed value is also reset to zero on trade closure so the post-cooldown chart starts clean.

The chart stays clean. While no trade is active, the Hunting Layer shows what the script is monitoring. The moment a signal fires, every hunting visual that did not contribute to the signal and is not contextually inside the trade's expected path is erased. Contributors and contextual zones are recolored to the signal's direction and promoted into permanent history.

CHART EXAMPLE

1.ETH/USD 15m: Bullish Alignment: Expansion + BOS. Following a sharp bearish leg into a session low near 08:00, price entered a tight compression range between approximately 10:30 and 12:00. An expansion bar then broke above the last confirmed swing high (the LH pivot at ~11:00), firing the Compression-to-Expansion and Break of Structure detectors simultaneously. The framework printed a Bullish Alignment at 2036.60 with Invalidation at 2022.77. The market has advanced through Reference Level 1 (2050.43) and is approaching Reference Level 2 (2064.27).

snapshot

2.ETH/USD 15m: Bullish High-Confluence: Sweep + BOS + OB. During a Range regime under Active volatility phase (which tightened the confluence requirement to three patterns), price swept the sellside liquidity at approximately 10:30 below a confirmed swing low. After consolidation, the entry bar at approximately 13:30 mitigated a bullish Order Block and broke above the local pivot. Three patterns aligned at signal close, firing a Bullish High-Confluence setup at 2118.34 with Invalidation at 2097.19. The market is currently advancing toward Reference Level 1 (2139.49) and Reference Level 2 (2160.64

snapshot

3.ETH/USD 15m: Bearish Alignment: StopVol + BOS. Following a multi-hour consolidation between approximately 10:00 and 13:00 near the 2115–2125 area, price rejected the consolidation high with a high-volume bar at approximately 13:00, then broke below the local pivot. Stopping Volume and Break of Structure aligned on the same bar in a Volatile regime, firing a Bearish Alignment at 2110.89 with Invalidation at 2133.24. The setup is currently in progress, advancing toward Reference Level 1 (2088.54) and Reference Level 2 (2066.18), with a large sellside liquidity pool sitting in the path.

snapshot

HOW TO READ THE OUTPUT

When a setup fires you will see four horizontal levels with right-side labels:

ENTRY (solid line, signal-direction color)
The closing price of the signal bar.

REFERENCE LEVEL 1 (dashed line, reference color)
Placed at 1R by default. Informational only - the setup does not close here. Useful for partial-exit planning or scaling.

REFERENCE LEVEL 2 (dashed line, reference color)
Placed at 2R by default. Reaching this level closes the setup as a success.

INVALIDATION (dotted line, invalidation color)
Placed at 3 ATR from entry by default. Reaching this level closes the setup as a failure.

Outcome and historical record
The setup closes when either Reference Level 2 or Invalidation is reached intrabar. Outcome is detected on the bar's high/low. When a single bar's range spans both levels, the setup closes on that bar; the script does not assume intrabar order, so the user should treat such ambiguous closures cautiously when reviewing historical results.

When the trade closes, right-side labels and connectors are removed and the four lines freeze at the closure bar. The signal label at the firing bar remains as a permanent record. To keep object counts within TradingView limits on long histories, the script retains the most recent 400 signal labels and the most recent 400 closed-trade lines; older items are recycled automatically.

COOLDOWN
After any trade closes, the script waits a configurable number of bars before arming the next setup. Prevents back-to-back firing on noisy moves.

THE DASHBOARD

A 9-row status panel reports:

Regime - Trend Up, Trend Down, Range, Volatile, or Neutral.
Phase - Quiet, Normal, or Active.
Pattern rows - for each of the five behaviors: rolling Activity count and a Low / Medium / High Emphasis rating based on recent follow-through reliability on this chart.
Patterns Required - the integer minimum that must align for a signal to fire on the current bar. Equal to your "Minimum Patterns Required" input in Quiet and Normal phases; tightened by one (capped at five) in Active phase.
Status - Ready, Cooldown, or Signal Active.

THE HUNTING LAYER

Drawn while no trade is active and the script is hunting for confluence:

Buyside Liquidity zones - blue boxes above swing highs.
Sellside Liquidity zones - teal boxes below swing lows.
Bullish Order Blocks - teal boxes at the last bearish candle before a strong bullish impulse.
Bearish Order Blocks - red boxes at the last bullish candle before a strong bearish impulse.
Compression bars - amber boxes on narrow-range candles.
Stopping Volume markers - amber triangles at high-volume rejection candles at local extremes.
BOS labels - text labels at confirmed structural breaks, centered on the broken level.
Sweep markers - text labels at the bar where price violated a confirmed pivot extreme, marking where liquidity was taken.
Reclaim labels - text labels at the bar where price closed back inside the prior range, confirming the sweep. Together with the Sweep marker, these tell the complete two-event Sweep+Reclaim story.
HH / HL / LH / LL pivot labels - market structure narration. Pivots are independent of the BOS module switch and are shown whenever the pivot toggle is enabled.

Duplicate BOS, Sweep, and Reclaim markers at the same price level within a recent window are automatically suppressed. Each confirmed pivot can be swept and reclaimed at most once until a new pivot forms.

At signal fire
Each active hunting item is evaluated:

- If its pattern type contributed to the signal, it is recolored to the signal's direction and promoted to history.
- If it is a liquidity zone or order block sitting inside the trade's expected path AND structurally aligned with the trade, it is promoted as context.
- Everything else is erased instantly.

At signal fire, BOS and Reclaim markers are explicitly drawn so every fired setup carries its structural anchor. The Reclaim marker is guaranteed when the Sweep pattern contributed; the BOS marker is drawn when BOS contributed and no recent BOS marker exists at the same level.

TIMEFRAME GUIDANCE

1m and 3m - high-frequency scalping on liquid pairs (BTC/USDT, ETH/USDT, NQ, ES).
5m and 15m - intraday swing entries on the same instruments and other liquid markets.
30m and above - functional but signal frequency drops noticeably; suitable for positional approaches.

The Auto-Calibrate by Timeframe input automatically scales swing lookback, ATR length, volume lookback, sweep window, stopping-volume percentile, and compression lookback. Disable only for full manual control.

HOW TO USE IT

1. Load on a clean chart. Leave Auto-Calibrate enabled.
2. Watch the Hunting Layer to see what the script is monitoring.
3. Wait for a signal label to print at bar close. The label text lists the contributing patterns.
4. The four levels appear automatically.
5. The setup auto-closes when Reference Level 2 or Invalidation is reached. After cooldown, hunting resumes.

INPUTS GUIDE

Auto-Calibrate by Timeframe - master switch that scales all lookbacks to the chart timeframe.

Pattern Modules - enable or disable any of the five detectors individually.

Core Parameters - manual swing, ATR, and volume lookbacks (used when Auto-Calibrate is OFF).

Pattern Tuning - per-pattern sensitivity controls.

Adaptive Learning - evaluation window, follow-through threshold in ATR multiples, learning memory, and minimum emphasis floor.

Regime Filter - toggle regime awareness and set its lookback.

Volatility Phase - toggle phase-based threshold tightening and set its lookback.

Confluence Decay - toggle linear decay of residual opposing scores.

Output - Quiet Mode (only High-Confluence tier fires), minimum patterns required, cooldown bars, RR for Reference Levels 1 and 2, Invalidation distance in ATR multiples, and label offset from the last bar.

Visual - color tones for bullish, bearish, reference, invalidation, and label background.

ICT Hunting Layer - individual toggles and color controls for every visual element and the legend panel.

ALERTS

Six alert conditions cover every tier and direction combination:

- Bullish High-Confluence
- Bearish High-Confluence
- Bullish Alignment
- Bearish Alignment
- Bullish Watch
- Bearish Watch
Add through the standard TradingView alert dialog.

TECHNICAL NOTES

- All pattern detection and signal arming occur on confirmed bar close. No intrabar fires, no repaint.
- No request.security() calls. No higher-timeframe lookups. No lookahead modifiers. No future leakage.
- Pivots use 3-bar right confirmation - structural lag is intentional and removes false breaks.
- The script uses one active trade slot at a time. New setups can only arm after the current one closes and cooldown expires.
- Same-bar conflict between Reference Level 2 and Invalidation resolves conservatively as invalidation. This is the honest interpretation when intrabar order is unknown.
- Object retention is bounded: 400 signal labels, 400 closed-trade lines, 400 hunting-history items. Adaptive learning memory is configurable up to 1000 bars per pattern.

WHAT THIS SCRIPT IS NOT

- Not a strategy. It does not place trades or compute P&L.
- Not a holy grail. No indicator is.
- Not a black box. Every threshold and lookback is exposed as an input.
- Not predictive. It reacts to confirmed structural events at bar close.

DISCLAIMER

This script is published as an open-source educational and analytical tool. It does not constitute financial advice, a recommendation to buy or sell any instrument, or any guarantee of future performance. Past behavior of any pattern on any chart does not guarantee future results. You are solely responsible for your trading decisions, your risk management, and your testing on a demo environment before any live use. The author and TradingView accept no liability for losses incurred from use of this script.

CREDITS

Concepts inspired by public ICT (Inner Circle Trader) educational material. All detection logic, scoring, regime classification, adaptive learning, lifecycle management, and visualization is original implementation by the author.

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.