OPEN-SOURCE SCRIPT

Breaker Block Identifier [algo_aakash]

384
Breaker Block Identifier is a market structure indicator that converts failed order block retests into scored, non-repainting breaker zones. Rather than flagging every order block that gets invalidated, the script requires a complete sequence of confirmed price events — order block formation, an opposing structure break, a retracement into the invalidated zone, and a failed retest of that zone — before a breaker is created, and then ranks the result with a transparent quality score.

Problem Statement
Order blocks are frequently invalidated by a structure break and later retested, but a retest failing to continue in the original direction is not automatically a tradable breaker block. Many public scripts draw a zone as soon as an order block is broken, without verifying that the subsequent retest actually failed, how deep that retest penetrated, or how convincingly price rejected the zone. This produces a high volume of low-quality zones that require manual filtering by the trader.

This indicator addresses that gap by treating breaker formation as a multi-stage state machine rather than a single condition, and by scoring every candidate that completes the sequence so weak retests can be filtered out programmatically instead of visually.

Methodology
Swing highs and lows are identified with ta.pivothigh/ta.pivotlow using a user-defined bar count on each side, so every structural level referenced by the script is a confirmed pivot, never a forming one.

An order block source candle is located as the last opposite-colored candle at or immediately before each confirmed swing pivot, within a fixed lookback. The candle must exceed a minimum size expressed as a multiple of ATR, and can optionally be required to close on above-average volume. Zone boundaries can be set to the candle body (open/close) or the full wick range (high/low).

Every order block candidate then moves through three internal states. In the Pending state the script waits for an opposing structure break (a close beyond the relevant swing high or low, optionally required to clear the level by a minimum ATR multiple). Once that break occurs the candidate becomes Flipped, and the script waits for price to retrace back into the now-invalidated zone. On entry into the zone the candidate becomes Retesting, and the script tracks the deepest penetration price reaches inside the zone on a bar-by-bar basis.

A Retesting candidate resolves in one of two ways. If price closes back through the zone in its original direction by the confirmation displacement threshold, the retest is judged to have held and the candidate is discarded with no breaker created. If price instead closes through the opposite edge of the zone by the same displacement threshold, and the tracked penetration depth met a minimum percentage of the zone's height (the Retest Qualification Filter), the retest is judged to have failed and the order block is converted into a breaker in the opposite direction of its original bias.

Each confirmed breaker is then scored from 0 to 100 using six independent, user-weighted factors: the displacement strength of the invalidating structure break, the ATR-relative size of the original order block candle, how closely the retest penetration matched a user-defined ideal depth (scored on a curve, so both shallow touches and near-total breaches score lower than a clean mid-zone tag), the wick-rejection ratio of the confirming candle, how quickly the retest resolved relative to the retest window, and the ATR-normalized distance price traveled before returning to retest. The six sub-scores are combined using auto-normalized weights, so a breaker only appears on the chart, gets drawn, and triggers alerts if it clears the configured minimum quality threshold.

Confirmed breakers remain in an Active/Touched state until price closes through the far edge of the zone by the invalidation displacement threshold, at which point the zone is marked invalidated, visually dimmed, and removed after a configurable linger period. A hard maximum-age limit and a per-direction cap on active zone count prevent unbounded object growth.

Signal Workflow
Step 1 — a confirmed swing pivot forms and an order block candidate is registered from the qualifying source candle behind it.
Step 2 — the candidate waits in a Pending state until an opposing structure break (BOS/CHoCH) closes beyond the originating swing level.
Step 3 — once flipped, the candidate waits for price to re-enter the invalidated zone, entering the Retesting state and tracking maximum penetration depth.
Step 4 — the retest resolves: a displacement close back through the zone in the original direction discards the candidate, while a displacement close through the opposite edge with sufficient penetration confirms a breaker.
Step 5 — the confirmed breaker is scored across six weighted factors and only drawn, labeled, and alerted on if it meets the minimum quality threshold.
Step 6 — the active breaker zone extends forward until price closes through its far edge by the invalidation displacement threshold, at which point it dims and is scheduled for removal.

Why This Indicator Is Different
Most public order block or breaker scripts draw a zone the moment an order block is invalidated by a structure break, without separately validating whether the ensuing retest actually failed.
This script models breaker formation as an explicit four-state pipeline (source candle, pending, flipped, retesting) and only creates a zone after the retest resolves against its original direction with a minimum measured penetration depth.
The Breaker Quality Score converts six independently disclosed factors, including retest penetration depth scored on a curve around a configurable ideal value rather than a simple threshold, into a single adjustable ranking rather than a cosmetic label.
Quality-score weighting is fully exposed, allowing the ranking to be tuned toward structure strength, retest precision, wick rejection, confirmation speed, or impulse distance depending on the trader's approach.
Zone fill transparency scales with the quality score, so higher-ranked breakers render more opaque and lower-ranked ones fade into the background without adding separate visual elements.
An optional formation preview renders the retest phase of a candidate before it resolves, giving visibility into why a breaker did or did not form without permanently cluttering the chart.

Inputs

Structure Settings
Swing Pivot Length
Displacement Filter on Structure Break
Structure Break Displacement (x ATR)
ATR Length

Order Block Detection
Use Candle Body for Zone Boundaries
Min Order Block Size (x ATR)
Candidate Expiry (bars)
Volume Confirmation Filter
Volume MA Length
Volume Multiplier Threshold

Breaker Conversion Rules
Retest Window (bars)
Confirmation Displacement (x ATR)
Min Retest Penetration (%)

Quality Score
Filter Breakers by Quality Score
Minimum Quality Score
Ideal Retest Penetration Ratio
Advanced weight sliders for structure break strength, impulse size, retest precision, wick rejection, confirmation speed, and distance traveled

Visual Settings
Bullish/Bearish Breaker Colors
Min/Max Fill Transparency
Show Zone Midline
Show Quality Label
Label Size
Formation Preview toggle and color

Lifecycle & Cleanup
Max Active Breakers (per side)
Invalidation Displacement (x ATR)
Invalidated Linger (bars)
Max Breaker Age (bars)

Info Panel
Show Info Panel
Panel Position

Alerts
Alerts are available for:
Bullish Breaker Block formed
Bearish Breaker Block formed
Structure confirmation on breaker conversion
Price entering an active breaker zone
Breaker invalidated

Practical Usage
Use the info panel's structure bias reading as directional context before evaluating individual breaker zones.
Treat a fresh, high-quality breaker aligned with the prevailing structure bias as a potential continuation zone rather than a standalone entry signal.
Raise the minimum quality threshold on lower timeframes or noisy instruments to reduce the number of marginal zones drawn.
Use the retest penetration and displacement settings together to control how strict the failed-retest qualification is for your instrument and timeframe.
Combine the alert feed with a broader trade plan, since each alert marks a structural event, not an execution signal.

Limitations
Swing pivots require bars to form on both sides before they confirm, so structure breaks and order block placement are inherently delayed by the swing pivot length.
The order block source candle is located within a fixed lookback behind each pivot; if no qualifying candle exists in that window, no candidate is created for that pivot.
Quality scoring is a relative ranking based on disclosed, adjustable factors and does not predict the outcome of any individual breaker zone.
Volume-based filtering depends on the data provider's reported volume and may behave inconsistently on instruments with limited or unreliable volume data.
As with any structure-based tool, results will vary across instruments, timeframes, and market regimes.

Notes
This indicator is a market structure analysis tool intended to organize and rank breaker block formation through a disclosed, multi-stage validation process.
All structure breaks, state transitions, breaker confirmations, and invalidations are evaluated on confirmed bar closes only, so no element of the script repaints once drawn.
The output is intended to support structural analysis and is not a standalone buy or sell recommendation.

免責事項

これらの情報および投稿は、TradingViewが提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。