OPEN-SOURCE SCRIPT
Atualizado AG Pro Order Block Reaction Quality [AGPro Series]

AG Pro Order Block Reaction Quality [AGPro Series]
OVERVIEW / WHAT IT DOES
AG Pro Order Block Reaction Quality is an overlay tool designed to organize how price interacts with displacement-origin order block zones. The script identifies the last opposite candle before a strong impulsive move, projects that candle as a bullish or bearish order block, and then tracks whether price later respects, reacts to, or invalidates that zone.
The goal is not to treat every order block as equally important. Instead, the script focuses on reaction quality. When price revisits a tracked zone, the script evaluates the behavior around that revisit and converts the response into a structured quality score. This helps separate zones that produce cleaner reactions from zones that fail, weaken, or transition into breaker behavior.
The indicator is built as a chart-organization tool, not as a prediction engine. It is intended to help users study where impulsive moves originated, how later revisits behaved, and whether those revisits showed clean rejection, weak response, or invalidation. In that sense, the script is less about drawing boxes and more about mapping reaction structure around previously important displacement areas.
Because order block concepts are often displayed in a highly subjective way, this script uses deterministic conditions to reduce ambiguity. Impulse detection, order block selection, reaction-window scoring, and breaker conversion all follow rules-based logic. The objective is to make price interaction around those zones easier to inspect, compare, and review across different market conditions.
UNIQUE EDGE
Many order block tools focus mainly on detection. They draw a bullish or bearish block, then leave the interpretation to the user. This script adds an evaluation layer on top of that detection process. Rather than only asking where an order block exists, it also asks how convincingly price reacted when that zone was revisited.
That difference matters. Two zones may look similar at first glance, but the quality of the revisit can be very different. One revisit may reject cleanly and preserve the zone, while another may penetrate deeply, stall, or fully invalidate. By assigning reaction scores and grade-style labels, the script helps organize those differences visually.
The script also distinguishes active order blocks from breaker behavior. If a previously tracked zone is invalidated, the visualization shifts from standard order block context into breaker context. This adds structural continuity to the chart and helps users see when an old reaction area has lost its original character.
In practical use, the unique edge is the combination of three layers: impulsive-origin zone detection, revisit-based reaction scoring, and breaker-state continuity. Together, those layers aim to give traders a cleaner framework for studying order block behavior than a simple box-drawing approach.
METHODOLOGY
1) Impulse detection
The script first searches for strong directional candles whose range is large relative to ATR and whose move exceeds a recent breakout threshold. This is used as a rules-based approximation of displacement or impulsive participation.
2) Order block definition
Once an impulsive move is detected, the script searches backward for the last opposite candle inside a configurable lookback window. That candle becomes the source order block. Depending on settings, the zone can be projected using the full candle range or the candle body only.
3) Zone persistence and revisit tracking
After a zone is created, the script tracks whether price later trades back into it. That first interaction is important because it provides the data needed to evaluate how the revisit behaved.
4) Reaction quality scoring
When price revisits the zone, the script measures the behavior inside a reaction window. The score is based on factors such as entry precision into the zone, the magnitude of rejection away from the zone, structural integrity of the zone during the test, and the strength of the originating impulse. Those components are combined into a normalized score.
5) Grade translation
The raw score is then translated into a visual grade tier. This is meant to improve chart readability and allow faster comparison between zones that produced stronger versus weaker reactions.
6) Breaker conversion
If price invalidates a zone after it has been engaged, the script can treat that structure as a breaker block. This keeps prior structural context on the chart instead of simply removing it.
7) Visual organization
Bullish zones, bearish zones, and breaker structures are displayed with separate color families so users can distinguish standard order block context from post-invalidation context more quickly.
SIGNALS & ALERTS
The script includes alerts for newly detected bullish and bearish order blocks. These alerts are event-based and are intended to mark when a new candidate zone has been identified according to the script’s internal impulse and source-candle rules.
In addition, the visual state of the chart provides three broad categories of information:
- Active bullish or bearish order blocks that remain structurally valid.
- Breaker blocks that represent previously tracked zones after invalidation.
- Quality-scored reactions that help compare the strength of revisits.
These states should be interpreted as structural context, not as standalone trade instructions. A bullish order block on the chart does not guarantee a long setup, and a bearish order block does not guarantee a short setup. The script is designed to help users study reaction behavior around important zones, not to replace execution rules, risk management, or broader market context.
KEY INPUTS
ATR Length
Controls the volatility baseline used in impulse sizing and reaction calculations.
Impulse Size (x ATR)
Defines how large a move must be, relative to ATR, before it is treated as an impulsive displacement event.
OB Search Bars Back
Controls how far back the script looks for the last opposite candle that becomes the source order block.
Zone Mode
Lets the user choose whether zones are based on the full candle range or the candle body only.
Max Zones Tracked
Limits how many zones remain in memory and on the chart.
Zone Max Age (Bars)
Removes older zones after a defined number of bars so the chart does not grow indefinitely cluttered.
Reaction Window (Bars)
Defines the number of bars used to evaluate how price behaves after a zone is revisited.
Zone Extend (Bars)
Controls how far zones project into the future for chart visualization.
Show 50% Midline
Displays an internal midpoint inside the zone for users who want an additional internal reference.
Show Impulse Markers
Shows or hides impulse-origin markers on the chart.
Label Size
Controls the size of chart labels.
Panel Theme / Panel Font Size / Panel Position
These settings control the visual appearance and placement of the information panel.
LIMITATIONS & TRANSPARENCY
Order block analysis is inherently interpretive, and any script that formalizes it must impose strict rules. That means the script’s logic is intentionally selective. It will not match every discretionary order block definition used by every trader.
The script uses a specific rules-based approximation of impulse, source candle selection, revisit handling, and reaction scoring. As a result, some zones that a discretionary analyst might manually highlight will not appear, while some zones shown by the script may not align with every subjective framework.
Reaction quality is also dependent on the configured reaction window and the selected volatility context. Changing settings can change how aggressive or conservative the script becomes. For that reason, the indicator should be treated as a structured analytical model rather than an objective statement of market truth.
Breaker behavior shown by the script reflects the script’s invalidation logic only. It does not imply that a breaker block will necessarily act as support or resistance in the future. It simply preserves structural history after the original order block state is lost.
This indicator does not use volume profile, order flow, DOM data, or external market microstructure feeds. All calculations are derived from chart data available inside Pine Script.
RISK DISCLOSURE
This script is for chart analysis, research, and educational use. It does not provide financial advice, investment recommendations, or guaranteed outcomes.
No indicator can reliably predict future price movement on its own. Order block reactions may fail, clean-looking zones may break, and high scores do not ensure continuation or reversal. Market context, liquidity conditions, volatility regime, timeframe selection, and execution quality all matter.
Users should test settings carefully, apply independent judgment, and use appropriate risk management. This script should be treated as a decision-support tool for studying price interaction around displacement-origin zones, not as a standalone trading system.
OVERVIEW / WHAT IT DOES
AG Pro Order Block Reaction Quality is an overlay tool designed to organize how price interacts with displacement-origin order block zones. The script identifies the last opposite candle before a strong impulsive move, projects that candle as a bullish or bearish order block, and then tracks whether price later respects, reacts to, or invalidates that zone.
The goal is not to treat every order block as equally important. Instead, the script focuses on reaction quality. When price revisits a tracked zone, the script evaluates the behavior around that revisit and converts the response into a structured quality score. This helps separate zones that produce cleaner reactions from zones that fail, weaken, or transition into breaker behavior.
The indicator is built as a chart-organization tool, not as a prediction engine. It is intended to help users study where impulsive moves originated, how later revisits behaved, and whether those revisits showed clean rejection, weak response, or invalidation. In that sense, the script is less about drawing boxes and more about mapping reaction structure around previously important displacement areas.
Because order block concepts are often displayed in a highly subjective way, this script uses deterministic conditions to reduce ambiguity. Impulse detection, order block selection, reaction-window scoring, and breaker conversion all follow rules-based logic. The objective is to make price interaction around those zones easier to inspect, compare, and review across different market conditions.
UNIQUE EDGE
Many order block tools focus mainly on detection. They draw a bullish or bearish block, then leave the interpretation to the user. This script adds an evaluation layer on top of that detection process. Rather than only asking where an order block exists, it also asks how convincingly price reacted when that zone was revisited.
That difference matters. Two zones may look similar at first glance, but the quality of the revisit can be very different. One revisit may reject cleanly and preserve the zone, while another may penetrate deeply, stall, or fully invalidate. By assigning reaction scores and grade-style labels, the script helps organize those differences visually.
The script also distinguishes active order blocks from breaker behavior. If a previously tracked zone is invalidated, the visualization shifts from standard order block context into breaker context. This adds structural continuity to the chart and helps users see when an old reaction area has lost its original character.
In practical use, the unique edge is the combination of three layers: impulsive-origin zone detection, revisit-based reaction scoring, and breaker-state continuity. Together, those layers aim to give traders a cleaner framework for studying order block behavior than a simple box-drawing approach.
METHODOLOGY
1) Impulse detection
The script first searches for strong directional candles whose range is large relative to ATR and whose move exceeds a recent breakout threshold. This is used as a rules-based approximation of displacement or impulsive participation.
2) Order block definition
Once an impulsive move is detected, the script searches backward for the last opposite candle inside a configurable lookback window. That candle becomes the source order block. Depending on settings, the zone can be projected using the full candle range or the candle body only.
3) Zone persistence and revisit tracking
After a zone is created, the script tracks whether price later trades back into it. That first interaction is important because it provides the data needed to evaluate how the revisit behaved.
4) Reaction quality scoring
When price revisits the zone, the script measures the behavior inside a reaction window. The score is based on factors such as entry precision into the zone, the magnitude of rejection away from the zone, structural integrity of the zone during the test, and the strength of the originating impulse. Those components are combined into a normalized score.
5) Grade translation
The raw score is then translated into a visual grade tier. This is meant to improve chart readability and allow faster comparison between zones that produced stronger versus weaker reactions.
6) Breaker conversion
If price invalidates a zone after it has been engaged, the script can treat that structure as a breaker block. This keeps prior structural context on the chart instead of simply removing it.
7) Visual organization
Bullish zones, bearish zones, and breaker structures are displayed with separate color families so users can distinguish standard order block context from post-invalidation context more quickly.
SIGNALS & ALERTS
The script includes alerts for newly detected bullish and bearish order blocks. These alerts are event-based and are intended to mark when a new candidate zone has been identified according to the script’s internal impulse and source-candle rules.
In addition, the visual state of the chart provides three broad categories of information:
- Active bullish or bearish order blocks that remain structurally valid.
- Breaker blocks that represent previously tracked zones after invalidation.
- Quality-scored reactions that help compare the strength of revisits.
These states should be interpreted as structural context, not as standalone trade instructions. A bullish order block on the chart does not guarantee a long setup, and a bearish order block does not guarantee a short setup. The script is designed to help users study reaction behavior around important zones, not to replace execution rules, risk management, or broader market context.
KEY INPUTS
ATR Length
Controls the volatility baseline used in impulse sizing and reaction calculations.
Impulse Size (x ATR)
Defines how large a move must be, relative to ATR, before it is treated as an impulsive displacement event.
OB Search Bars Back
Controls how far back the script looks for the last opposite candle that becomes the source order block.
Zone Mode
Lets the user choose whether zones are based on the full candle range or the candle body only.
Max Zones Tracked
Limits how many zones remain in memory and on the chart.
Zone Max Age (Bars)
Removes older zones after a defined number of bars so the chart does not grow indefinitely cluttered.
Reaction Window (Bars)
Defines the number of bars used to evaluate how price behaves after a zone is revisited.
Zone Extend (Bars)
Controls how far zones project into the future for chart visualization.
Show 50% Midline
Displays an internal midpoint inside the zone for users who want an additional internal reference.
Show Impulse Markers
Shows or hides impulse-origin markers on the chart.
Label Size
Controls the size of chart labels.
Panel Theme / Panel Font Size / Panel Position
These settings control the visual appearance and placement of the information panel.
LIMITATIONS & TRANSPARENCY
Order block analysis is inherently interpretive, and any script that formalizes it must impose strict rules. That means the script’s logic is intentionally selective. It will not match every discretionary order block definition used by every trader.
The script uses a specific rules-based approximation of impulse, source candle selection, revisit handling, and reaction scoring. As a result, some zones that a discretionary analyst might manually highlight will not appear, while some zones shown by the script may not align with every subjective framework.
Reaction quality is also dependent on the configured reaction window and the selected volatility context. Changing settings can change how aggressive or conservative the script becomes. For that reason, the indicator should be treated as a structured analytical model rather than an objective statement of market truth.
Breaker behavior shown by the script reflects the script’s invalidation logic only. It does not imply that a breaker block will necessarily act as support or resistance in the future. It simply preserves structural history after the original order block state is lost.
This indicator does not use volume profile, order flow, DOM data, or external market microstructure feeds. All calculations are derived from chart data available inside Pine Script.
RISK DISCLOSURE
This script is for chart analysis, research, and educational use. It does not provide financial advice, investment recommendations, or guaranteed outcomes.
No indicator can reliably predict future price movement on its own. Order block reactions may fail, clean-looking zones may break, and high scores do not ensure continuation or reversal. Market context, liquidity conditions, volatility regime, timeframe selection, and execution quality all matter.
Users should test settings carefully, apply independent judgment, and use appropriate risk management. This script should be treated as a decision-support tool for studying price interaction around displacement-origin zones, not as a standalone trading system.
Notas de Lançamento
Update Notes - V1.1This update focuses on visual clarity, panel structure, and overall chart cleanliness.
• Refined the panel layout with a single merged first row for a cleaner header structure.
• Applied the standardized blue header style to keep the panel aligned with the current AGPro visual system.
• Set the default panel font size to Small for a more compact presentation.
• Set the default label size to Normal to improve readability on live charts.
• Improved label spacing and placement so zone labels sit more cleanly on the right side.
• Rebalanced the zone visuals for a cleaner overlay appearance while keeping the reaction areas easy to track.
• Kept the midline and zone structure visually lighter so candles remain easier to read.
• Maintained the existing reaction-quality workflow while refining the presentation layer.
• Improved the general visual consistency of active order blocks, breaker blocks, and graded zones.
• Included small structural cleanup adjustments to support a more stable and polished chart view.
This update is designed to improve readability and presentation without changing the core purpose of the script.
For analysis and charting support only. Not financial advice.
Notas de Lançamento
UPDATE NOTES - V1.2This update keeps the original Order Block Reaction Quality logic and chart behavior intact while refreshing the script presentation for a cleaner AGPro release standard.
What changed
- Updated the panel to the AGPro model with a merged blue header row and a cleaner dark panel body.
- Preserved panel position, theme, and font-size controls for flexible chart placement.
- Refreshed the script introduction block to the current AGPro Series format.
- Kept the detection, scoring, zone rendering, and alert logic unchanged.
Notas de Lançamento
UPDATE NOTES - V2.0This update focuses on reaction-quality clarity, visual hierarchy, and cleaner chart interpretation.
The core purpose of the script remains unchanged.
Order Block Reaction Quality still evaluates how price behaves when it returns to a displacement-origin order block.
This release improves how the existing logic is presented, organized, and interpreted on the chart.
It does not attempt to predict price direction or provide guaranteed outcomes.
------------------------
What Changed
------------------------
* Added a 0-100 Reaction Quality score.
The score evaluates block origin, reaction strength, mitigation depth, reclaim behavior, and volume support.
* Added clearer next-action states.
The panel now translates the active block context into Fresh, Testing, Reclaimed, READY, Follow-through, Invalidated, and a practical next step.
* Added invalidation and target guide rails.
Touched blocks can now show a clean invalidation edge and a target guide based on the block edge and risk distance.
* Preserved failed reaction zones on the chart.
Invalidated blocks can remain visible by default so the chart keeps its order-block context instead of turning visually empty after failed reactions.
* Refined the public title.
The public indicator title removes the leading AG Pro prefix while the panel header keeps the AG Pro title standard.
------------------------
Visual Improvements
------------------------
* Rebuilt zone labels into a cleaner zone-native format.
Block labels now sit inside the zone as transparent, zone-colored text instead of chip-style labels.
* Reduced zone label density with a tighter 2-line layout.
Zone labels now show block identity and state on the first line, then score and mitigation depth on the second line.
* Added clearer separation between zone labels and event labels.
Zone labels describe the block itself, while NEW, TEST, RECLAIM, READY, FAILED, and FOLLOW remain separate event markers.
* Improved event label spacing.
Nearby event labels on the same side now stack outward using ATR-based spacing to reduce overlap in active clusters.
* Kept invalidated zones visually distinct.
Failed blocks now remain readable through softer fills, dashed borders, and failure-oriented wording.
------------------------
Interface & Usability
------------------------
* Rebuilt the panel around the V2 roadmap rows:
Active Block, Reaction Quality, Mitigation, Invalidation, and Action.
* Preserved the AGPro panel standard with one merged blue header row containing only the panel title.
* Added configurable panel location, panel theme, panel font size, and label font size.
* Kept the panel visible by default with a show/hide input.
* Added Sensitivity, Confirmation Mode, Minimum READY Score, cooldown, expiry, max-visible, and event-spacing controls.
------------------------
Behavior Notes
------------------------
This update preserves the Order Block Reaction Quality identity.
The script remains focused on the reaction phase after price returns to a displacement-origin order block.
It does not become a generic Order Block scanner.
It does not become a Fair Value Gap map.
It does not become a Breaker Block Engine or Mitigation Block Quality clone.
The goal is to improve decision support around reaction quality, not to introduce predictive behavior.
------------------------
Alerts
------------------------
The update includes alert conditions for:
* New Bullish Reaction Block
* New Bearish Reaction Block
* Order Block Reaction READY
* Order Block Reaction Reclaim
* Order Block Reaction Invalidated
* Order Block Reaction Follow-Through
Alerts are attention markers.
They are not trade instructions.
------------------------
Limitations Reminder
------------------------
The script remains a rule-based analytical tool.
Displacement-origin order blocks depend on the selected sensitivity, lookback, volatility conditions, and timeframe.
Market conditions such as liquidity, volatility expansion, and low-volume noise may affect how reaction blocks appear and how quickly they invalidate.
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.
Script de código aberto
Em verdadeiro espírito do TradingView, o criador deste script o tornou de código aberto, para que os traders possam revisar e verificar sua funcionalidade. Parabéns ao autor! Embora você possa usá-lo gratuitamente, lembre-se de que a republicação do código está sujeita às nossas Regras da Casa.
⚡ Precision Pine tools for crypto & FX traders
📊 ICT • Smart Money • Market Structure • Liquidity
🧠 Rules-based decision tools. No hype. No guesswork
⭐ Public AGPro Series + advanced invite-only tools
💬 t.me/agprolabs
📊 ICT • Smart Money • Market Structure • Liquidity
🧠 Rules-based decision tools. No hype. No guesswork
⭐ Public AGPro Series + advanced invite-only tools
💬 t.me/agprolabs
Aviso legal
As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.
Script de código aberto
Em verdadeiro espírito do TradingView, o criador deste script o tornou de código aberto, para que os traders possam revisar e verificar sua funcionalidade. Parabéns ao autor! Embora você possa usá-lo gratuitamente, lembre-se de que a republicação do código está sujeita às nossas Regras da Casa.
⚡ Precision Pine tools for crypto & FX traders
📊 ICT • Smart Money • Market Structure • Liquidity
🧠 Rules-based decision tools. No hype. No guesswork
⭐ Public AGPro Series + advanced invite-only tools
💬 t.me/agprolabs
📊 ICT • Smart Money • Market Structure • Liquidity
🧠 Rules-based decision tools. No hype. No guesswork
⭐ Public AGPro Series + advanced invite-only tools
💬 t.me/agprolabs
Aviso legal
As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.