OPEN-SOURCE SCRIPT
Updated

Rejection Block Quality [AGPro Series]

13 572
Rejection Block Quality [AGPro Series]

🔹 OVERVIEW

Rejection Block Quality is an ICT-inspired detector that identifies long-wick rejection candles at swept swing pivots and grades each block by objective quality criteria. Unlike Order Block logic — which anchors to the last opposite-direction body before displacement — a Rejection Block (RB) is born from a wick that pierces a prior swing liquidity pool and closes back inside it, with the body confirming displacement on the follow-through bar. The rectangle is drawn from the wick base to the candle body, capturing the exact zone where smart money absorbed the sweep.

🎯 UNIQUE EDGE

Three design choices separate this tool from generic wick or order block indicators:

• Swing-pivot sweep requirement — a rejection is only counted when price sweeps a confirmed swing high or low before the reversal close. Stand-alone wick patterns without liquidity context are filtered out.

• Displacement confirmation window — the candle following the rejection must travel at least 0.6× ATR in the reversal direction, within a 1–5 bar lookahead. No displacement, no block.

• Quality tiering (A / B / C) from three orthogonal factors — wick-to-body ratio, displacement magnitude, and untested freshness. An exceptional wick ratio (≥5× body) promotes a block to A tier regardless of other scores, preserving rare high-conviction rejections.

🛠️ METHODOLOGY

Detection pipeline on every bar:

1. Confirm a pivot sweep using a user-configurable lookback (default 5 bars each side).
2. Check the wick-to-body ratio against a minimum threshold (default 1.8×), with the dominant wick on the sweep side.
3. Queue the candle as a pending block and wait for displacement confirmation.
4. Measure displacement as price travel from the body reference over 1 to 5 bars, normalized by ATR.
5. On confirmation, draw the RB zone from the wick base to the body, record the tier, and begin lifecycle tracking.

Zone lifecycle tracks four events — test (price enters the zone), hold (price exits without a body close through the far edge), break (body close through the far edge), and near miss (price approaches within a configurable ATR band without entering). All events are edge-detected to prevent inflated counts when price lingers near a zone.

📊 SIGNALS & ALERTS

• New block formation label — A / B / C tier plus wick ratio, placed with anti-collision offset.
• Test markers (T) — one per zone entry event, with cooldown to prevent visual clutter.
• Break markers (B) — placed when a zone is invalidated by a body close.
• Wick border highlight — thick colored line on the originating rejection candle.
• Alerts — configurable minimum tier (A, B, or C) fires once per bar close for each qualifying new block.

⚙️ KEY INPUTS

• Detection — Pivot Length, Min Wick-to-Body Ratio, ATR Length, Min Displacement (× ATR), Displacement Confirm Window.
• Zone Management — Max Active Zones per Side, Zone Right Extension, Near-Miss Distance, Near-Miss Cooldown, Break Requires Full Body Close.
• Visuals — Show Zones, Show Tier Labels, Highlight Rejection Wick Border, Show Test / Hold / Break Markers, Zone Fill Opacity, Label Font Size.
• Panel — Show Panel, Panel Location, Panel Font Size, Panel Theme (Dark / Light).
• Alerts — Minimum Tier for Alerts.

🧭 HOW TO USE

Start on a higher timeframe (4H or 1D) to identify macro RB zones, then drill down to execution timeframes for entries. Treat A-tier blocks as the highest-conviction zones, B-tier as situational, and C-tier as context-only. Combine with trend filters, higher-timeframe structure, and risk management — a Rejection Block is a zone of interest, not a standalone buy or sell signal. Use the panel statistics to evaluate how the selected symbol and timeframe have historically respected these zones before committing to them in live decision-making.

⚠️ LIMITATIONS & TRANSPARENCY

This indicator is a structural detector, not a trading strategy. It does not forecast price direction, generate entry or exit orders, or calculate position sizing. The Success Rate statistic reflects how often past tests on detected zones held versus failed within the visible history — it is a descriptive metric, not a performance projection. Zone detection is historical and reactive: a block only appears after the displacement bar closes, so interpretation on live-forming bars is tentative. Performance varies by symbol, timeframe, and market regime.

⚠️ RISK DISCLOSURE

Trading involves substantial risk of loss. Past behavior of any pattern does not guarantee future outcomes. Use this tool as part of a complete analytical framework that includes your own risk management, position sizing, and broader market context. Nothing in this indicator or description constitutes financial advice.
Release Notes
🔧 UPDATE NOTES - V2.2

This update restores the visible rejection-zone identity while keeping the cleaner V2 lifecycle improvements.

The core purpose of the script remains unchanged.
This release corrects the overly aggressive V2.1 visual cleanup by bringing historical rejection zones back into the default view.

This script continues to function as an analytical and visualization tool.
It does not attempt to predict price direction or provide guaranteed outcomes.


------------------------
What Changed
------------------------

• Restored the default zone layer
Historical rejection zones are visible by default again because the zone structure is a core part of this script's public appeal.

• Kept closed-state label clutter under control
Expired and invalidated zone text remains hidden by default, so the chart keeps the zones without becoming filled with archive labels.

• Increased zone projection
The default zone extension is longer again, closer to the original visual identity of Rejection Block Quality.

• Increased default visible zones
The default visible-zone count is restored to support the stronger public screenshot style of this script.

• Preserved the improved decision engine
The 0-100 score, survival score, reclaim state, and action-state logic remain active.


------------------------
Visual Improvements
------------------------

• Zones are back as first-class visual objects.

• Mature zones remain visible with a softer appearance instead of disappearing.

• Large expired / invalid text is not shown by default.

• Bullish and bearish zones keep clear AGPro color separation.


------------------------
Interface & Usability
------------------------

• Show Historical Zones is enabled by default.

• Show Closed-State Labels remains disabled by default.

• Users can still hide historical zones manually if they prefer a very minimal chart.

• Panel location, panel theme, panel font size, and label font size controls remain unchanged.


------------------------
Behavior Notes
------------------------

This update protects the original identity of one of the strongest AGPro public scripts.

The script remains focused on rejection blocks and does not become an Order Block, Breaker Block, or generic support/resistance map.

The goal is to keep the premium zone-based chart appeal while improving interpretation through the newer lifecycle panel.


------------------------
Limitations Reminder
------------------------

The script remains a rule-based analytical tool.

Market conditions such as volatility, liquidity, and timeframe differences may affect how rejection blocks appear and survive.

Outputs should always be interpreted within broader market context.


------------------------
Risk Reminder
------------------------

This script is for educational and analytical purposes only.

It does not provide financial advice or guaranteed trading outcomes.

Users remain responsible for their own decisions.
Release Notes
UPDATE NOTES - v2.4

This update focuses on premium presentation and readability.

The core purpose of the script remains unchanged. This release improves how the
existing rejection-block information is presented on the chart and in the panel,
on both light and dark backgrounds.

This script continues to function as an analytical and visualization tool. It
does not attempt to predict price direction or provide guaranteed outcomes.


------------------------
What Changed
------------------------

- Premium centered zone badge
Each rejection-block zone now shows a solid, color-filled badge centered both
vertically and horizontally inside the zone, instead of plain floating text.
The badge carries its own background so the block label reads cleanly on any
chart background and keeps a consistent premium look with the lifecycle labels.

- Panel readability on both themes
The panel was reworked so every row label and value reads clearly on both the
dark and light themes. Row backgrounds were given stronger separation, and
value cells with colored backgrounds now choose their text color based on the
cell background for reliable contrast.

- Cleaner chart after invalidation
Once a rejection block is invalidated (broken), its zone is now fully removed
from the chart on both light and dark themes, so only active and still-valid
zones remain. This keeps the chart clean and consistent across themes.

- Calmer label density on lower timeframes
The default spacing between repeated lifecycle labels was increased slightly so
Test and Hold labels no longer cluster as tightly in fast conditions.

- Minor header and source cleanup, plus version maintenance.


------------------------
Visual Improvements
------------------------

- Centered, contrast-safe zone badges that stay readable on light and dark
charts.

- Clearer panel text on the light theme across all rows.

- Refined visual hierarchy so the zone badges, lifecycle labels, and panel read
cleanly together.

- Preserved label offsets that keep lifecycle labels above or below candles.


------------------------
Interface & Usability
------------------------

- Improved background-contrast handling for both the zone badges and the panel.

- Consistent premium styling between zone badges and lifecycle labels.

- Adjusted default visual presentation for a more balanced, premium appearance.

- Enhanced overall user experience without changing core logic.


------------------------
Behavior Notes
------------------------

This update does not change the core analytical logic of the script.

Swing-sweep detection, the rejection-block scoring, the survival lifecycle
(Test / Hold / Reclaim / Invalidate), and the panel all behave exactly as
before.

Users should interpret outputs the same way as before, but with a cleaner and
more readable presentation.


------------------------
Limitations Reminder
------------------------

The script remains a rule-based analytical tool.

Market conditions such as volatility, liquidity, and timeframe differences may
affect how rejection blocks form and survive. Outputs should always be
interpreted within broader market context.


------------------------
Risk Reminder
------------------------

This script is for educational and analytical purposes only.

It does not provide financial advice or guaranteed trading outcomes. Users
remain responsible for their own decisions.

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.