OPEN-SOURCE SCRIPT
Mis à jour Swing Retest Quality [AGPro Series]

Swing Retest Quality [AGPro Series]
🧠 Core Idea
Is the active swing retest clean enough to treat as valid context, or is the pullback too weak, too deep, or too hard to plan?
📌 Overview / What it does
Swing Retest Quality [AGPro Series] is a chart-first swing retest planner built to evaluate pullbacks into an active swing leg.
The script maps a focused swing retest pocket, defense line, target-room zone, compact labels, deterministic alerts, and a clean AGPro panel. It converts swing clarity, retest depth, wick rejection, close response, and volume support into a 0-100 Retest Quality score.
It does not predict future price movement, automate entries, print buy/sell commands, or replace broader market context. Its purpose is to help traders judge whether a swing retest has enough structure to deserve attention.
🎯 Purpose & Design Philosophy
This script was built for traders who evaluate pullbacks, retests, and continuation structure but want a more disciplined way to judge retest quality.
Many tools show structure levels or retest markers without answering the practical planning question: is this retest clean, defended, and readable enough to review?
The design philosophy is simple: a retest is not useful just because price touches a level. It becomes useful when the swing reference is clear, the pullback depth is controlled, the response is readable, and risk/target context can be mapped.
⚡ Why This Script Is Different
Most tools focus on support/resistance touches, break-and-retest markers, BOS/CHOCH events, or broad supply/demand zones.
This script does NOT clone Break-Retest Quality, does not require a structure break first, does not map order blocks, does not create a generic S/R zone map, and does not become a broad swing scanner.
Instead, it evaluates one active swing leg and asks whether the pullback into that swing has enough quality to be treated as valid context. The main output is not a trade command. It is a planner state: VALID RETEST, WATCH, DEFENSE REVIEW, LOST, or WAIT.
⚙️ Methodology
1. Context Detection
The script detects confirmed swing highs and lows, then identifies the active bull or bear swing leg.
2. Reference Mapping
It builds a concept-native retest pocket inside the active swing, adds a defense line behind the swing origin, and projects a target-room zone toward the swing terminal.
3. Reaction Evaluation
The model scores swing clarity, retest depth, wick rejection, close response, and optional volume support.
4. Visual Output
The result is displayed through a centered retest pocket, centered target-room zone, defense guide, swing leg, compact labels, alerts, and a premium AGPro panel.
🗺️ How to Read the Chart
Zones = the retest pocket shows where a pullback into the active swing leg is being evaluated. The target-room zone shows the available room back toward the swing terminal or extension guide.
Labels = compact event labels mark pocket tests, hold retests, watch states, room reviews, and defense-loss events.
Colors = teal marks cleaner bull-side retest context, pink marks bear-side or lost-defense context, amber marks caution/review, and indigo marks watch/transition context.
Panel = the panel summarizes Retest Quality, Swing Side, Defense State, Risk Room, and Action.
🚦 Signals & States
• VALID RETEST → the active swing retest is holding with enough quality and room for review.
• WATCH → the retest context is improving, but confirmation is incomplete.
• DEFENSE REVIEW → price has tested the pocket, but quality, response, or room is not strong enough.
• LOST → price has crossed the defense line and the swing context should be rebuilt.
• WAIT → no active swing retest context is strong enough yet.
🔔 Alerts Logic
Alerts trigger when price touches the swing retest pocket, when a valid swing retest appears, when a watch state appears, when target room becomes limited, and when the defense line is lost.
These alerts are attention markers only. They are not trade instructions, entry signals, or automated strategy commands.
🧩 Confluence Logic
The strongest context appears when a clear swing leg is followed by a controlled retest depth, visible wick rejection, a constructive close response, supportive relative volume, and enough target room relative to the defense line.
When these components align, the Retest Quality score improves and the state can move from WATCH to VALID RETEST.
📊 When to Use
• During pullbacks inside a clear directional swing
• When price is retesting a prior swing leg rather than breaking a new structure level
• When planning continuation context around a readable defense line
• When comparing whether a pullback is clean enough to monitor or too weak to trust
• On liquid symbols where pivots, candles, and volume behavior are readable
⚠️ When NOT to Use
• Very low-liquidity symbols with irregular candles
• Extremely noisy micro-timeframes
• News-driven spikes where swing structure becomes distorted
• Markets where volume is unreliable and should not affect scoring
• Situations where the user expects a signal-only entry tool
🎛️ Key Inputs
• Swing Pivot Length → controls how confirmed swing highs and lows are detected.
• Max Swing Age → controls how long a swing leg remains active.
• Shallow / Deep Pocket Depth → controls the retest pocket inside the swing leg.
• Ideal Retest Depth → defines the preferred pullback depth for stronger scoring.
• Defense Buffer ATR → controls the defense line behind the swing origin.
• Minimum Target Room ATR → defines how much room is preferred before VALID state.
• Label and Panel Font Size → controls chart labels, centered zone text, and panel readability.
🖥️ Interface & Visual Design
The interface is designed to stay chart-first.
The retest pocket gives the main visual story. The defense line defines where the swing context becomes weak. The target-room zone shows whether the pullback still has practical room to evaluate.
The AGPro panel uses a merged blue title row and a compact decision hierarchy so the user can read state, quality, risk, and next action quickly.
🧪 Practical Usage Workflow
1. Read the panel state and Retest Quality score.
2. Check whether price has touched the swing retest pocket.
3. Review the defense line and target-room zone.
4. Evaluate whether the label says HOLD, WATCH, ROOM REVIEW, or DEFENSE LOST.
5. Compare the retest with broader trend, liquidity, volatility, and timeframe context.
🔍 Interpretation Guidelines
Think in terms of retest quality, not prediction.
A stronger score means multiple structural conditions are aligned. A weaker score means the swing may be unclear, the pullback may be too shallow or too deep, the response may be weak, or target room may be limited.
The script helps organize the review process. It does not decide for the user.
🚫 What This Script Is NOT
• Not a prediction engine
• Not financial advice
• Not an auto-trading system
• Not a guaranteed signal tool
• Not a Break-Retest Quality clone
• Not a BOS/CHOCH scanner
• Not a generic support/resistance zone map
• Not a supply/demand, order block, or FVG map
⚠️ Limitations & Transparency
• Pivot-based swing references depend on the selected Swing Pivot Length.
• Scores can vary across symbols, sessions, and timeframes.
• Volume support depends on exchange-provided volume data.
• Fast, news-driven movement can distort retest depth and defense readings.
• In Live Updating mode, active-bar values can change before the bar closes.
🧠 Market Context Notes
Swing retests are most useful when the broader chart has readable structure.
Liquidity, volatility, trend maturity, and higher-timeframe context can all affect whether a retest should be treated as meaningful. The script provides a structured review layer, not a complete trading system.
🧾 Use Case Examples
When a bull swing is clear and price pulls back into the retest pocket, a HOLD RETEST label with a strong score indicates that the pullback response is clean enough to review.
When price touches the pocket but target room is too limited, ROOM REVIEW highlights that the structure may be readable but planning space is constrained.
When price crosses the defense line, DEFENSE LOST indicates that the active swing context should be rebuilt.
🧱 System Philosophy
Swing Retest Quality follows the AGPro decision-engine approach: map the context, score the quality, show the risk reference, show the target room, and summarize the next action without issuing trade commands.
🔐 Non-Promise Statement
No indicator can provide certainty.
The script does not guarantee that a retest will hold, continue, reverse, or produce any specific outcome.
📉 Risk Disclosure
Trading involves risk.
Users are responsible for their own analysis, risk management, and trading decisions.
This script is provided for educational and analytical purposes only and does not constitute financial advice.
📚 Educational Note
Use the script as a structured retest-review framework. The best results come from combining the panel, zones, labels, and alerts with broader chart context and disciplined risk evaluation.
🧠 Core Idea
Is the active swing retest clean enough to treat as valid context, or is the pullback too weak, too deep, or too hard to plan?
📌 Overview / What it does
Swing Retest Quality [AGPro Series] is a chart-first swing retest planner built to evaluate pullbacks into an active swing leg.
The script maps a focused swing retest pocket, defense line, target-room zone, compact labels, deterministic alerts, and a clean AGPro panel. It converts swing clarity, retest depth, wick rejection, close response, and volume support into a 0-100 Retest Quality score.
It does not predict future price movement, automate entries, print buy/sell commands, or replace broader market context. Its purpose is to help traders judge whether a swing retest has enough structure to deserve attention.
🎯 Purpose & Design Philosophy
This script was built for traders who evaluate pullbacks, retests, and continuation structure but want a more disciplined way to judge retest quality.
Many tools show structure levels or retest markers without answering the practical planning question: is this retest clean, defended, and readable enough to review?
The design philosophy is simple: a retest is not useful just because price touches a level. It becomes useful when the swing reference is clear, the pullback depth is controlled, the response is readable, and risk/target context can be mapped.
⚡ Why This Script Is Different
Most tools focus on support/resistance touches, break-and-retest markers, BOS/CHOCH events, or broad supply/demand zones.
This script does NOT clone Break-Retest Quality, does not require a structure break first, does not map order blocks, does not create a generic S/R zone map, and does not become a broad swing scanner.
Instead, it evaluates one active swing leg and asks whether the pullback into that swing has enough quality to be treated as valid context. The main output is not a trade command. It is a planner state: VALID RETEST, WATCH, DEFENSE REVIEW, LOST, or WAIT.
⚙️ Methodology
1. Context Detection
The script detects confirmed swing highs and lows, then identifies the active bull or bear swing leg.
2. Reference Mapping
It builds a concept-native retest pocket inside the active swing, adds a defense line behind the swing origin, and projects a target-room zone toward the swing terminal.
3. Reaction Evaluation
The model scores swing clarity, retest depth, wick rejection, close response, and optional volume support.
4. Visual Output
The result is displayed through a centered retest pocket, centered target-room zone, defense guide, swing leg, compact labels, alerts, and a premium AGPro panel.
🗺️ How to Read the Chart
Zones = the retest pocket shows where a pullback into the active swing leg is being evaluated. The target-room zone shows the available room back toward the swing terminal or extension guide.
Labels = compact event labels mark pocket tests, hold retests, watch states, room reviews, and defense-loss events.
Colors = teal marks cleaner bull-side retest context, pink marks bear-side or lost-defense context, amber marks caution/review, and indigo marks watch/transition context.
Panel = the panel summarizes Retest Quality, Swing Side, Defense State, Risk Room, and Action.
🚦 Signals & States
• VALID RETEST → the active swing retest is holding with enough quality and room for review.
• WATCH → the retest context is improving, but confirmation is incomplete.
• DEFENSE REVIEW → price has tested the pocket, but quality, response, or room is not strong enough.
• LOST → price has crossed the defense line and the swing context should be rebuilt.
• WAIT → no active swing retest context is strong enough yet.
🔔 Alerts Logic
Alerts trigger when price touches the swing retest pocket, when a valid swing retest appears, when a watch state appears, when target room becomes limited, and when the defense line is lost.
These alerts are attention markers only. They are not trade instructions, entry signals, or automated strategy commands.
🧩 Confluence Logic
The strongest context appears when a clear swing leg is followed by a controlled retest depth, visible wick rejection, a constructive close response, supportive relative volume, and enough target room relative to the defense line.
When these components align, the Retest Quality score improves and the state can move from WATCH to VALID RETEST.
📊 When to Use
• During pullbacks inside a clear directional swing
• When price is retesting a prior swing leg rather than breaking a new structure level
• When planning continuation context around a readable defense line
• When comparing whether a pullback is clean enough to monitor or too weak to trust
• On liquid symbols where pivots, candles, and volume behavior are readable
⚠️ When NOT to Use
• Very low-liquidity symbols with irregular candles
• Extremely noisy micro-timeframes
• News-driven spikes where swing structure becomes distorted
• Markets where volume is unreliable and should not affect scoring
• Situations where the user expects a signal-only entry tool
🎛️ Key Inputs
• Swing Pivot Length → controls how confirmed swing highs and lows are detected.
• Max Swing Age → controls how long a swing leg remains active.
• Shallow / Deep Pocket Depth → controls the retest pocket inside the swing leg.
• Ideal Retest Depth → defines the preferred pullback depth for stronger scoring.
• Defense Buffer ATR → controls the defense line behind the swing origin.
• Minimum Target Room ATR → defines how much room is preferred before VALID state.
• Label and Panel Font Size → controls chart labels, centered zone text, and panel readability.
🖥️ Interface & Visual Design
The interface is designed to stay chart-first.
The retest pocket gives the main visual story. The defense line defines where the swing context becomes weak. The target-room zone shows whether the pullback still has practical room to evaluate.
The AGPro panel uses a merged blue title row and a compact decision hierarchy so the user can read state, quality, risk, and next action quickly.
🧪 Practical Usage Workflow
1. Read the panel state and Retest Quality score.
2. Check whether price has touched the swing retest pocket.
3. Review the defense line and target-room zone.
4. Evaluate whether the label says HOLD, WATCH, ROOM REVIEW, or DEFENSE LOST.
5. Compare the retest with broader trend, liquidity, volatility, and timeframe context.
🔍 Interpretation Guidelines
Think in terms of retest quality, not prediction.
A stronger score means multiple structural conditions are aligned. A weaker score means the swing may be unclear, the pullback may be too shallow or too deep, the response may be weak, or target room may be limited.
The script helps organize the review process. It does not decide for the user.
🚫 What This Script Is NOT
• Not a prediction engine
• Not financial advice
• Not an auto-trading system
• Not a guaranteed signal tool
• Not a Break-Retest Quality clone
• Not a BOS/CHOCH scanner
• Not a generic support/resistance zone map
• Not a supply/demand, order block, or FVG map
⚠️ Limitations & Transparency
• Pivot-based swing references depend on the selected Swing Pivot Length.
• Scores can vary across symbols, sessions, and timeframes.
• Volume support depends on exchange-provided volume data.
• Fast, news-driven movement can distort retest depth and defense readings.
• In Live Updating mode, active-bar values can change before the bar closes.
🧠 Market Context Notes
Swing retests are most useful when the broader chart has readable structure.
Liquidity, volatility, trend maturity, and higher-timeframe context can all affect whether a retest should be treated as meaningful. The script provides a structured review layer, not a complete trading system.
🧾 Use Case Examples
When a bull swing is clear and price pulls back into the retest pocket, a HOLD RETEST label with a strong score indicates that the pullback response is clean enough to review.
When price touches the pocket but target room is too limited, ROOM REVIEW highlights that the structure may be readable but planning space is constrained.
When price crosses the defense line, DEFENSE LOST indicates that the active swing context should be rebuilt.
🧱 System Philosophy
Swing Retest Quality follows the AGPro decision-engine approach: map the context, score the quality, show the risk reference, show the target room, and summarize the next action without issuing trade commands.
🔐 Non-Promise Statement
No indicator can provide certainty.
The script does not guarantee that a retest will hold, continue, reverse, or produce any specific outcome.
📉 Risk Disclosure
Trading involves risk.
Users are responsible for their own analysis, risk management, and trading decisions.
This script is provided for educational and analytical purposes only and does not constitute financial advice.
📚 Educational Note
Use the script as a structured retest-review framework. The best results come from combining the panel, zones, labels, and alerts with broader chart context and disciplined risk evaluation.
Notes de version
UPDATE NOTES - VERSION 1.2This update focuses on a small visual-polish improvement for the Target Room badge.
The core purpose of the script remains unchanged.
This release improves how the existing swing retest pocket, target-room zone, defense line, quality score, and panel context are presented 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
------------------------
* Refined Target Room badge color
The Target Room badge now uses a premium blue tone for better visual hierarchy and stronger alignment with the AGPro interface style.
* Preserved centered badge rendering
Retest Pocket and Target Room text remain separate centered labels instead of embedded box text.
* Kept V1.1 presentation controls
Adaptive HTF Projection, Zone Badge Anchor, Slate theme, and Huge font options remain unchanged.
* Kept core logic unchanged
Swing detection, scoring, zones, labels, alerts, and panel logic were not changed.
------------------------
Visual Improvements
------------------------
* Improved chart readability by making the Target Room badge easier to distinguish from the zone background.
* Added a more polished color relationship between the blue panel header and target-room label.
* Preserved the visual hierarchy between retest pocket, target room, swing leg, defense line, event labels, and panel.
* Preserved the original public-release identity while improving screenshot polish.
------------------------
Interface & Usability
------------------------
* Optimized panel theme selection for dark, slate, and light chart layouts.
* Improved label sizing flexibility for high-resolution publication screenshots.
* Added better badge-placement control for crowded swing retest structures.
* Enhanced overall user experience without changing the core swing retest model.
------------------------
Behavior Notes
------------------------
This update does not change the core analytical logic of the script.
Swing detection, retest-pocket construction, target-room logic, defense-line logic, quality scoring, labels, panel rows, and alerts remain conceptually unchanged.
The goal is to improve clarity and usability, not to introduce new predictive behavior.
------------------------
Limitations Reminder
------------------------
The script remains a rule-based analytical tool.
Market conditions such as volatility, liquidity, swing clarity, timeframe differences, and volume quality may affect how swing retest states 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.
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 and invite-only TradingView Pine Script tools for market analysis, risk planning, liquidity and execution review.
Script library & access: aligurtuna.com/agprolabs-pine-scriptleri/
Telegram: t.me/agprolabs
Script library & access: aligurtuna.com/agprolabs-pine-scriptleri/
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 and invite-only TradingView Pine Script tools for market analysis, risk planning, liquidity and execution review.
Script library & access: aligurtuna.com/agprolabs-pine-scriptleri/
Telegram: t.me/agprolabs
Script library & access: aligurtuna.com/agprolabs-pine-scriptleri/
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.