OPEN-SOURCE SCRIPT
Mis à jour Structure Retest Planner [AGPro Series]

Structure Retest Planner [AGPro Series]
🧠 Core Idea
Is the active structure retest being accepted, rejected, or invalidated?
📌 Overview / What it does
Structure Retest Planner [AGPro Series] is a structure-based trade planning overlay designed to help traders evaluate how price behaves when it returns to an important swing-derived structure rail.
The script maps the active support-side or resistance-side rail, draws a focused retest box around that rail, scores the retest from 0-100, and projects practical invalidation and target guides. The goal is to organize the retest decision process: structure state, score, acceptance, invalidation, and next action.
It does not predict the next move, does not automate trading, and does not turn every swing point into a generic support/resistance signal. It is a decision-support planner for reading acceptance and rejection around a live structure retest.
🎯 Purpose & Design Philosophy
This script was built for traders who use price structure but need a cleaner way to judge whether a retest deserves attention.
Most structure tools identify levels, breaks, or swing labels. Structure Retest Planner focuses on the next decision after a rail is present: is price responding cleanly enough, is invalidation nearby, and what should be reviewed next?
The design supports a planning mindset rather than a signal-chasing mindset. It is meant to make the chart easier to interpret while keeping the trader responsible for context and risk.
⚡ Why This Script Is Different
Most tools focus on plotting structure breaks, BOS / CHoCH labels, or broad support and resistance zones.
This script does NOT clone a BOS / CHoCH detector and does NOT duplicate a first-break retest grader.
Instead, it treats the active structure rail as a planning reference and evaluates acceptance, rejection, volatility fit, trend agreement, invalidation distance, and next-action state in one workflow.
⚙️ Methodology
1. Context Detection
The script confirms swing-derived structure rails using pivot logic and identifies whether the active planning side is support retest, resistance retest, or automatic nearest-rail context.
2. Reference Mapping
It draws a retest box around the active rail, plus an invalidation shelf and target guide. These are planning references, not guaranteed outcomes.
3. Reaction Evaluation
The 0-100 score combines level origin quality, retest response, close location, volatility fit, and trend agreement.
4. Visual Output
The script shows a centered retest-box label, compact event labels, rail/invalidation/target guides, alerts, and a premium AG Pro panel.
🗺️ How to Read the Chart
Zones = the active retest box around the selected structure rail.
Labels = watch, accepted, rejected, invalidated, or risk-review states with optional score and grade.
Colors = teal for support-side acceptance, pink for resistance-side or rejection pressure, yellow for review states, and indigo for planning context.
Panel = structure state, retest score, acceptance state, invalidation shelf, and next action.
🚦 Signals & States
• Retest Watch → price is close enough to the active rail and the score is improving.
• Accepted → price tested the rail and closed constructively on the expected side.
• Ready → acceptance is active and the score reached the ready threshold.
• Rejected → price tested the rail but did not show clean acceptance.
• Invalidated → price closed beyond the invalidation shelf.
• Risk Review → retest behavior exists, but volatility is too hot for clean reading.
🔔 Alerts Logic
Alerts trigger when the script detects a new watch state, accepted retest, high-quality retest review, rejected retest, or invalidation shelf break.
Alerts are attention markers. They are not trade instructions and should always be interpreted with broader market context.
🧩 Confluence Logic
The score improves when the active rail has a cleaner structural origin, price reacts near the rail, the close lands on the expected side, volatility is not overheated, and trend context agrees with the retest side.
When these factors align, the retest context becomes easier to review. When they conflict, the panel shifts toward waiting, context confirmation, risk review, or reset.
📊 When to Use
• Pullbacks toward confirmed swing structure
• Trend continuation retests
• Resistance retests after bearish structure pressure
• Support retests after bullish structure pressure
• Markets where structure rails are visible and not excessively noisy
⚠️ When NOT to Use
• Very low-liquidity symbols
• Extremely noisy sideways markets
• News-driven volatility spikes
• Markets where pivot structure is too compressed to provide useful rails
• Any situation where the user expects automated entry or exit instructions
🎛️ Key Inputs
• Retest Side → selects Auto, Support Retest, or Resistance Retest.
• Structure Pivot Length → controls how structure rails are confirmed.
• Sensitivity → changes retest-box width and activation behavior.
• Retest Ready Score → sets the minimum score for stronger review states.
• Invalidation Shelf ATR → adjusts the planning invalidation reference.
• Target Guide R Multiple → projects the forward target guide from planning risk.
• Label and Panel Font Size → controls visual readability.
• Panel Location and Theme → adjusts interface placement and style.
🖥️ Interface & Visual Design
The panel is built as a compact planning dashboard with one merged blue AG Pro header row and five decision rows.
The chart visuals are intentionally restrained: one active retest box, centered box text, structure rail, invalidation shelf, target guide, and controlled labels.
The design goal is to make the active retest decision readable without turning the chart into a dense support/resistance map.
🧪 Practical Usage Workflow
1. Read the panel to identify the active structure state.
2. Check whether price is approaching or testing the retest box.
3. Review the retest score and acceptance state.
4. Compare the invalidation shelf and target guide.
5. Use your own broader context before making any decision.
🔍 Interpretation Guidelines
A higher score means the retest is cleaner within the script's rule set. It does not mean price must continue.
Acceptance means the bar closed constructively relative to the rail. Rejection means the rail is not holding cleanly. Invalidation means the planning reference has been crossed and the setup should be reviewed again.
Use the script to organize thinking, not to outsource judgment.
🚫 What This Script Is NOT
• Not a prediction engine
• Not financial advice
• Not auto trading
• Not guaranteed signals
• Not a BOS / CHoCH auto detector
• Not a generic support/resistance zone map
⚠️ Limitations & Transparency
The script uses pivot-based structure, so rails appear only after pivots are confirmed.
Timeframe choice, volatility, liquidity, and symbol behavior can materially change how retests appear.
Fast markets may pass through a rail before the retest can be evaluated cleanly. Sideways markets may create repeated low-quality tests.
🧠 Market Context Notes
Structure retests are easier to interpret when liquidity, trend context, and volatility are aligned.
A clean rail is not enough on its own. The reaction, close location, invalidation distance, and broader environment all matter.
🧾 Use Case Examples
When price returns to a prior support rail and closes back above it with a strong lower wick, the planner may shift from watch to accepted if the score is high enough.
When price tests resistance but closes back below the rail with volatility under control, the planner may mark a cleaner resistance-side review state.
When price closes beyond the invalidation shelf, the planner marks the context as invalidated and the plan should be reset.
🧱 System Philosophy
Structure Retest Planner is part of the AGPro Series decision-engine direction: tools should help traders answer what is valid, how strong it is, where risk is, and what should be reviewed next.
🔐 Non-Promise Statement
No signal from this script guarantees continuation, reversal, or profit.
The output is a structured analytical read, not certainty.
📉 Risk Disclosure
Trading involves risk.
Users are responsible for their own analysis, risk management, and decisions.
This script does not provide financial advice and does not guarantee trading outcomes.
📚 Educational Note
Use the planner to study how structure retests behave across symbols and timeframes, especially how acceptance, rejection, volatility, and invalidation interact.
🧠 Core Idea
Is the active structure retest being accepted, rejected, or invalidated?
📌 Overview / What it does
Structure Retest Planner [AGPro Series] is a structure-based trade planning overlay designed to help traders evaluate how price behaves when it returns to an important swing-derived structure rail.
The script maps the active support-side or resistance-side rail, draws a focused retest box around that rail, scores the retest from 0-100, and projects practical invalidation and target guides. The goal is to organize the retest decision process: structure state, score, acceptance, invalidation, and next action.
It does not predict the next move, does not automate trading, and does not turn every swing point into a generic support/resistance signal. It is a decision-support planner for reading acceptance and rejection around a live structure retest.
🎯 Purpose & Design Philosophy
This script was built for traders who use price structure but need a cleaner way to judge whether a retest deserves attention.
Most structure tools identify levels, breaks, or swing labels. Structure Retest Planner focuses on the next decision after a rail is present: is price responding cleanly enough, is invalidation nearby, and what should be reviewed next?
The design supports a planning mindset rather than a signal-chasing mindset. It is meant to make the chart easier to interpret while keeping the trader responsible for context and risk.
⚡ Why This Script Is Different
Most tools focus on plotting structure breaks, BOS / CHoCH labels, or broad support and resistance zones.
This script does NOT clone a BOS / CHoCH detector and does NOT duplicate a first-break retest grader.
Instead, it treats the active structure rail as a planning reference and evaluates acceptance, rejection, volatility fit, trend agreement, invalidation distance, and next-action state in one workflow.
⚙️ Methodology
1. Context Detection
The script confirms swing-derived structure rails using pivot logic and identifies whether the active planning side is support retest, resistance retest, or automatic nearest-rail context.
2. Reference Mapping
It draws a retest box around the active rail, plus an invalidation shelf and target guide. These are planning references, not guaranteed outcomes.
3. Reaction Evaluation
The 0-100 score combines level origin quality, retest response, close location, volatility fit, and trend agreement.
4. Visual Output
The script shows a centered retest-box label, compact event labels, rail/invalidation/target guides, alerts, and a premium AG Pro panel.
🗺️ How to Read the Chart
Zones = the active retest box around the selected structure rail.
Labels = watch, accepted, rejected, invalidated, or risk-review states with optional score and grade.
Colors = teal for support-side acceptance, pink for resistance-side or rejection pressure, yellow for review states, and indigo for planning context.
Panel = structure state, retest score, acceptance state, invalidation shelf, and next action.
🚦 Signals & States
• Retest Watch → price is close enough to the active rail and the score is improving.
• Accepted → price tested the rail and closed constructively on the expected side.
• Ready → acceptance is active and the score reached the ready threshold.
• Rejected → price tested the rail but did not show clean acceptance.
• Invalidated → price closed beyond the invalidation shelf.
• Risk Review → retest behavior exists, but volatility is too hot for clean reading.
🔔 Alerts Logic
Alerts trigger when the script detects a new watch state, accepted retest, high-quality retest review, rejected retest, or invalidation shelf break.
Alerts are attention markers. They are not trade instructions and should always be interpreted with broader market context.
🧩 Confluence Logic
The score improves when the active rail has a cleaner structural origin, price reacts near the rail, the close lands on the expected side, volatility is not overheated, and trend context agrees with the retest side.
When these factors align, the retest context becomes easier to review. When they conflict, the panel shifts toward waiting, context confirmation, risk review, or reset.
📊 When to Use
• Pullbacks toward confirmed swing structure
• Trend continuation retests
• Resistance retests after bearish structure pressure
• Support retests after bullish structure pressure
• Markets where structure rails are visible and not excessively noisy
⚠️ When NOT to Use
• Very low-liquidity symbols
• Extremely noisy sideways markets
• News-driven volatility spikes
• Markets where pivot structure is too compressed to provide useful rails
• Any situation where the user expects automated entry or exit instructions
🎛️ Key Inputs
• Retest Side → selects Auto, Support Retest, or Resistance Retest.
• Structure Pivot Length → controls how structure rails are confirmed.
• Sensitivity → changes retest-box width and activation behavior.
• Retest Ready Score → sets the minimum score for stronger review states.
• Invalidation Shelf ATR → adjusts the planning invalidation reference.
• Target Guide R Multiple → projects the forward target guide from planning risk.
• Label and Panel Font Size → controls visual readability.
• Panel Location and Theme → adjusts interface placement and style.
🖥️ Interface & Visual Design
The panel is built as a compact planning dashboard with one merged blue AG Pro header row and five decision rows.
The chart visuals are intentionally restrained: one active retest box, centered box text, structure rail, invalidation shelf, target guide, and controlled labels.
The design goal is to make the active retest decision readable without turning the chart into a dense support/resistance map.
🧪 Practical Usage Workflow
1. Read the panel to identify the active structure state.
2. Check whether price is approaching or testing the retest box.
3. Review the retest score and acceptance state.
4. Compare the invalidation shelf and target guide.
5. Use your own broader context before making any decision.
🔍 Interpretation Guidelines
A higher score means the retest is cleaner within the script's rule set. It does not mean price must continue.
Acceptance means the bar closed constructively relative to the rail. Rejection means the rail is not holding cleanly. Invalidation means the planning reference has been crossed and the setup should be reviewed again.
Use the script to organize thinking, not to outsource judgment.
🚫 What This Script Is NOT
• Not a prediction engine
• Not financial advice
• Not auto trading
• Not guaranteed signals
• Not a BOS / CHoCH auto detector
• Not a generic support/resistance zone map
⚠️ Limitations & Transparency
The script uses pivot-based structure, so rails appear only after pivots are confirmed.
Timeframe choice, volatility, liquidity, and symbol behavior can materially change how retests appear.
Fast markets may pass through a rail before the retest can be evaluated cleanly. Sideways markets may create repeated low-quality tests.
🧠 Market Context Notes
Structure retests are easier to interpret when liquidity, trend context, and volatility are aligned.
A clean rail is not enough on its own. The reaction, close location, invalidation distance, and broader environment all matter.
🧾 Use Case Examples
When price returns to a prior support rail and closes back above it with a strong lower wick, the planner may shift from watch to accepted if the score is high enough.
When price tests resistance but closes back below the rail with volatility under control, the planner may mark a cleaner resistance-side review state.
When price closes beyond the invalidation shelf, the planner marks the context as invalidated and the plan should be reset.
🧱 System Philosophy
Structure Retest Planner is part of the AGPro Series decision-engine direction: tools should help traders answer what is valid, how strong it is, where risk is, and what should be reviewed next.
🔐 Non-Promise Statement
No signal from this script guarantees continuation, reversal, or profit.
The output is a structured analytical read, not certainty.
📉 Risk Disclosure
Trading involves risk.
Users are responsible for their own analysis, risk management, and decisions.
This script does not provide financial advice and does not guarantee trading outcomes.
📚 Educational Note
Use the planner to study how structure retests behave across symbols and timeframes, especially how acceptance, rejection, volatility, and invalidation interact.
Notes de version
UPDATE NOTES - V1.1This update focuses on premium chart readability, label structure, and publication-grade visual clarity.
The core purpose of the script remains unchanged.
This release improves how the existing structure retest logic is presented, organized, and interpreted on the chart.
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
------------------------
* Added Smart Badge Lanes.
Retest, event, context, and invalidation badges now use ATR-based visual lanes to reduce label superposition around active structure rails.
* Converted retest box text into a one-line premium badge.
The active retest zone now displays compact structure, state, score, and grade information without stacked multi-line label text.
* Improved event label spacing.
Watch, accepted, ready, rejected, risk review, and invalidated labels now separate more cleanly when price reacts near the same rail.
* Updated the short title.
The shorttitle now uses "AG Pro STR" to better distinguish this script from Session Reclaim Planner while keeping the AGPro panel identity.
* Preserved the analytical model.
The pivot rail, retest zone, invalidation shelf, target guide, score model, panel, and alert logic remain conceptually unchanged.
------------------------
Visual Improvements
------------------------
* Improved chart readability by replacing multi-line zone labels with compact one-line colored badges.
* Reduced visual clutter while keeping the core retest box visible.
* Refined visual hierarchy so the active structure rail, retest state, and invalidation context remain clear.
* Adjusted positioning of labels to avoid stacking directly on candles or on the same rail price.
------------------------
Interface & Usability
------------------------
* Added "Use Smart Badge Lanes" to the Labels settings.
* Added "Badge Lane Spacing ATR" for fine-tuning vertical label separation.
* Kept label and panel font-size controls intact.
* Kept the AG Pro panel visible by default with the merged blue title row.
------------------------
Behavior Notes
------------------------
This update does not change the core analytical logic of the script.
The goal is to improve clarity and usability, not to introduce new predictive behavior.
Users should interpret outputs the same way as before, but with improved visual structure.
------------------------
Limitations Reminder
------------------------
The script remains a rule-based analytical tool.
Market conditions such as volatility, liquidity, and timeframe differences may affect how signals appear.
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.
Notes de version
🔧 UPDATE NOTES - v1.3This update focuses on decision clarity and trust: a real follow-through rate,
sharper label contrast, and cleaner badge spacing.
The core purpose of the script remains unchanged.
This release improves how the existing retest-planning logic is presented and
interpreted, and adds a transparent, sample-based follow-through rate on top of
the same detection.
This script continues to function as an analytical and planning tool.
It does not attempt to predict price direction or provide guaranteed outcomes.
------------------------
What Changed
------------------------
• Follow-Through Rate (real, sample-based)
The panel now reports how often an accepted retest actually followed through
toward the target side before the invalidation shelf was broken, measured over a
forward window. Cases that resolve neither way inside the window are left
uncounted, never scored as a failure, so the rate stays honest. A building state
is shown until enough samples accumulate.
• Sharper Label Contrast
Badge text color is now chosen by luminance, so light, amber, pink, and indigo
badges use dark text while teal badges use light text. This fixes cases where
some badges previously rendered with low-contrast text and looked faded.
• Decision-Oriented Panel
The panel now reads as a decision flow: Structure State, Retest Score,
Acceptance, Follow-Through rate, Invalidation, and Action.
• Steadier Badge Lanes
The centered retest-box label is drawn above the rail and invalidation lines so
its text stays crisp. Event and context badges now sit in clear vertical lanes
above or below the candles and are automatically nudged apart, so they no longer
overlap each other or sit on the structure lines on lower timeframes.
------------------------
Visual Improvements
------------------------
• Improved chart readability by adjusting label contrast and lane spacing.
• Reduced visual clutter so the active state, score, and action stand out at a
glance.
• Refined visual hierarchy so the centered box label, rail, invalidation, and
target guides are easier to separate.
• Adjusted positioning of badges to avoid overlap with structure lines.
------------------------
Interface & Usability
------------------------
• Optimized panel layout for a clearer flow from state to action.
• Improved label and badge readability for better chart interaction.
• Adjusted default spacing for a more balanced appearance.
• Enhanced overall user experience without changing the core logic.
------------------------
Behavior Notes
------------------------
This update does not change the core analytical logic of how rails, retest
scores, acceptance, and invalidation are computed.
The goal is to improve clarity, context, and usability. The follow-through rate
is a descriptive statistic derived from the same accepted retests and the
script's own invalidation shelf.
Users should interpret outputs the same way as before, now with added context
about historical follow-through.
------------------------
Limitations Reminder
------------------------
The script remains a rule-based analytical tool.
Market conditions such as volatility, liquidity, and timeframe differences may
affect how retests appear and how follow-through resolves.
The follow-through rate is a backward-looking, sample-based statistic computed on
the current symbol and timeframe. It describes past behavior and is not a
forecast. 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.
The invalidation shelf and target guide are planning references, not stop or
target recommendations. Users remain responsible for their own decisions.
Script open-source
Dans l'esprit TradingView, le créateur de ce script l'a rendu open source afin que les traders puissent examiner et vérifier ses fonctionnalités. Bravo à l'auteur! Bien que vous puissiez l'utiliser gratuitement, n'oubliez pas que la republication du code est soumise à nos Règles.
Public-free scripts + invite-only AGPro workflows for market analysis, liquidity context, risk planning and execution review.
Rules-based. No hype. No guesswork.
Library & access: agprolabs.com/
Telegram: t.me/agprolabs
Rules-based. No hype. No guesswork.
Library & access: agprolabs.com/
Telegram: t.me/agprolabs
Clause de non-responsabilité
Les informations et publications ne sont pas destinées à être, et ne constituent pas, des conseils ou recommandations financiers, d'investissement, de trading ou autres fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.
Script open-source
Dans l'esprit TradingView, le créateur de ce script l'a rendu open source afin que les traders puissent examiner et vérifier ses fonctionnalités. Bravo à l'auteur! Bien que vous puissiez l'utiliser gratuitement, n'oubliez pas que la republication du code est soumise à nos Règles.
Public-free scripts + invite-only AGPro workflows for market analysis, liquidity context, risk planning and execution review.
Rules-based. No hype. No guesswork.
Library & access: agprolabs.com/
Telegram: t.me/agprolabs
Rules-based. No hype. No guesswork.
Library & access: agprolabs.com/
Telegram: t.me/agprolabs
Clause de non-responsabilité
Les informations et publications ne sont pas destinées à être, et ne constituent pas, des conseils ou recommandations financiers, d'investissement, de trading ou autres fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.