OPEN-SOURCE SCRIPT
Mis à jour RSI Failure Swing Detector [AGPro Series]

RSI Failure Swing Detector [AGPro Series]
🔹 **Overview**
RSI Failure Swing Detector [AGPro Series] is a focused RSI reversal-structure tool built around one classic momentum concept: the confirmed RSI failure swing.
Instead of treating every oversold or overbought RSI reading as a reversal condition, this script waits for the full internal RSI sequence:
1. RSI reaches an extreme zone.
2. RSI recovers or reacts away from that extreme.
3. RSI pulls back while respecting the original RSI extreme.
4. RSI breaks the internal swing level that confirms the failure swing.
Only after that sequence is complete does the script mark a confirmed trigger on the chart.
The purpose is to make RSI failure swings easier to read in real time without turning the tool into a generic divergence scanner, RSI pressure map, or broad reversal dashboard.
🔹 **What Makes It Different**
Most RSI tools focus on one of three common ideas:
- RSI overbought and oversold levels.
- RSI divergence against price.
- RSI momentum or pressure state.
This script is intentionally different.
RSI Failure Swing Detector does not look for RSI divergence. It does not compare RSI swings against price swings to create hidden or regular divergence logic. It also does not measure RSI pressure, trend pressure, or directional dominance.
Its job is narrower and cleaner:
**It detects when RSI builds a classic failure swing sequence and then confirms that sequence through an internal RSI swing break.**
That keeps the tool separated from existing AGPro momentum scripts such as RSI Pressure Map, Stochastic Exhaustion Map, Multi-Oscillator Consensus Engine, Divergence Stack Scanner, and broader reversal-quality tools. The analytical lane here is not "is pressure building?" or "is price diverging?" The lane is:
**Has RSI completed a confirmed failure swing sequence?**
🔹 **Core Logic**
The bullish model starts when RSI moves into the oversold zone. The script then tracks the first recovery leg, waits for a pullback that stays meaningfully above the original RSI low, and confirms the pattern only when RSI breaks the recovery high.
The bearish model works in the opposite direction. It starts when RSI moves into the overbought zone, tracks the first reaction leg, waits for a bounce that stays meaningfully below the original RSI high, and confirms the pattern only when RSI breaks the reaction low.
This creates a clean four-part sequence:
- Extreme
- Recovery or reaction
- Controlled pullback
- Confirmed internal break
The confirmation step is important. The script is designed to avoid printing premature reversal labels while RSI is still only sitting at an extreme.
🔹 **Trigger Pockets**
When a failure swing is confirmed, the script can project a short chart-level trigger pocket from the confirmation bar.
These pockets are not generic support or resistance zones. They are failure-swing context zones designed to help the user visually track whether price respects or loses the area around a confirmed momentum trigger.
The pocket is time-limited, ATR-scaled, and capped by a maximum visible pocket setting so the chart remains clean.
🔹 **Panel**
The AGPro panel summarizes the active environment:
- RSI State
- Swing Stage
- Confirmation
- Sequence Score
- Trigger Pocket status
The first panel row follows the AGPro standard: one merged blue header row containing only the script title. Panel location, panel theme, label size, and panel font size are all configurable from settings.
🔹 **Visual Design**
The chart layer is intentionally restrained.
Stage labels explain where the RSI sequence is developing, while confirmed trigger labels appear only after the failure swing is complete. The default stage-label mode highlights only the final setup stage before confirmation, keeping lower-timeframe charts cleaner while still preserving the sequence logic.
Label cooldowns, maximum visible label limits, ATR-based offsets, compact trigger labels, and capped trigger pockets are included to keep the chart readable.
The default visual style is designed for a premium public chart: informative, but not crowded.
🔹 **Inputs**
Key settings include:
- RSI Length
- RSI Source
- Oversold Level
- Overbought Level
- Minimum RSI Separation
- Minimum RSI Pullback
- Maximum Sequence Bars
- Confirm On Bar Close
- Stage Label Detail
- Trigger Pocket Depth
- Trigger Pocket Projection Bars
- Panel Signal Memory Bars
- Label and panel size controls
- Panel location and theme controls
These settings allow the user to tune the detector for different symbols and timeframes while preserving the core failure swing structure.
🔹 **Best Use Case**
RSI Failure Swing Detector is best used when the trader wants a clean visual framework for RSI reversal structure without adding divergence complexity or broad pressure-state interpretation.
It can be useful for reviewing moments when RSI fails to retest its prior extreme and then confirms a momentum turn through its own internal swing level.
It is designed to organize one specific RSI pattern with cleaner confirmation, better visual hierarchy, and a focused chart workflow.
🔹 **Overview**
RSI Failure Swing Detector [AGPro Series] is a focused RSI reversal-structure tool built around one classic momentum concept: the confirmed RSI failure swing.
Instead of treating every oversold or overbought RSI reading as a reversal condition, this script waits for the full internal RSI sequence:
1. RSI reaches an extreme zone.
2. RSI recovers or reacts away from that extreme.
3. RSI pulls back while respecting the original RSI extreme.
4. RSI breaks the internal swing level that confirms the failure swing.
Only after that sequence is complete does the script mark a confirmed trigger on the chart.
The purpose is to make RSI failure swings easier to read in real time without turning the tool into a generic divergence scanner, RSI pressure map, or broad reversal dashboard.
🔹 **What Makes It Different**
Most RSI tools focus on one of three common ideas:
- RSI overbought and oversold levels.
- RSI divergence against price.
- RSI momentum or pressure state.
This script is intentionally different.
RSI Failure Swing Detector does not look for RSI divergence. It does not compare RSI swings against price swings to create hidden or regular divergence logic. It also does not measure RSI pressure, trend pressure, or directional dominance.
Its job is narrower and cleaner:
**It detects when RSI builds a classic failure swing sequence and then confirms that sequence through an internal RSI swing break.**
That keeps the tool separated from existing AGPro momentum scripts such as RSI Pressure Map, Stochastic Exhaustion Map, Multi-Oscillator Consensus Engine, Divergence Stack Scanner, and broader reversal-quality tools. The analytical lane here is not "is pressure building?" or "is price diverging?" The lane is:
**Has RSI completed a confirmed failure swing sequence?**
🔹 **Core Logic**
The bullish model starts when RSI moves into the oversold zone. The script then tracks the first recovery leg, waits for a pullback that stays meaningfully above the original RSI low, and confirms the pattern only when RSI breaks the recovery high.
The bearish model works in the opposite direction. It starts when RSI moves into the overbought zone, tracks the first reaction leg, waits for a bounce that stays meaningfully below the original RSI high, and confirms the pattern only when RSI breaks the reaction low.
This creates a clean four-part sequence:
- Extreme
- Recovery or reaction
- Controlled pullback
- Confirmed internal break
The confirmation step is important. The script is designed to avoid printing premature reversal labels while RSI is still only sitting at an extreme.
🔹 **Trigger Pockets**
When a failure swing is confirmed, the script can project a short chart-level trigger pocket from the confirmation bar.
These pockets are not generic support or resistance zones. They are failure-swing context zones designed to help the user visually track whether price respects or loses the area around a confirmed momentum trigger.
The pocket is time-limited, ATR-scaled, and capped by a maximum visible pocket setting so the chart remains clean.
🔹 **Panel**
The AGPro panel summarizes the active environment:
- RSI State
- Swing Stage
- Confirmation
- Sequence Score
- Trigger Pocket status
The first panel row follows the AGPro standard: one merged blue header row containing only the script title. Panel location, panel theme, label size, and panel font size are all configurable from settings.
🔹 **Visual Design**
The chart layer is intentionally restrained.
Stage labels explain where the RSI sequence is developing, while confirmed trigger labels appear only after the failure swing is complete. The default stage-label mode highlights only the final setup stage before confirmation, keeping lower-timeframe charts cleaner while still preserving the sequence logic.
Label cooldowns, maximum visible label limits, ATR-based offsets, compact trigger labels, and capped trigger pockets are included to keep the chart readable.
The default visual style is designed for a premium public chart: informative, but not crowded.
🔹 **Inputs**
Key settings include:
- RSI Length
- RSI Source
- Oversold Level
- Overbought Level
- Minimum RSI Separation
- Minimum RSI Pullback
- Maximum Sequence Bars
- Confirm On Bar Close
- Stage Label Detail
- Trigger Pocket Depth
- Trigger Pocket Projection Bars
- Panel Signal Memory Bars
- Label and panel size controls
- Panel location and theme controls
These settings allow the user to tune the detector for different symbols and timeframes while preserving the core failure swing structure.
🔹 **Best Use Case**
RSI Failure Swing Detector is best used when the trader wants a clean visual framework for RSI reversal structure without adding divergence complexity or broad pressure-state interpretation.
It can be useful for reviewing moments when RSI fails to retest its prior extreme and then confirms a momentum turn through its own internal swing level.
It is designed to organize one specific RSI pattern with cleaner confirmation, better visual hierarchy, and a focused chart workflow.
Notes de version
UPDATE NOTES - V1.1This update focuses on readability, visual hierarchy, label balance, panel structure, and clearer RSI failure swing confirmation.
The core purpose of the script remains unchanged.
This release improves how the existing RSI failure swing 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
------------------------
* Reworked the trigger pocket visual system.
The script still tracks the classic RSI failure swing sequence: extreme, recovery/reaction, pullback, and internal RSI confirmation break.
* Added centered labels inside trigger pockets.
Confirmed bullish and bearish RSI failure swing pockets now include compact centered labels so the pocket itself communicates direction and score.
* Added an engine preset layer.
Swing / 4H is the balanced default, Daily Selective is cleaner and more selective, and Custom keeps direct control over the raw inputs.
* Added automatic sub-4H visual cleanup.
Charts below 4H now reduce stage-label density and retained pocket history by default while the core confirmation logic remains active.
* Updated panel standards.
The public script title does not start with AG Pro, while the panel title keeps AG Pro branding. The panel header remains a single merged blue row.
------------------------
Visual Improvements
------------------------
* Improved chart readability by adjusting stage labels, trigger labels, trigger pockets, candle highlighting, and panel contrast.
* Reduced visual clutter to enhance first-glance interpretation.
* Refined visual hierarchy so sequence stages, confirmed triggers, and projected trigger pockets are easier to separate.
* Adjusted label placement to avoid overlap with candles by using ATR-based spacing.
* Added centered labels inside confirmed trigger pockets.
------------------------
Interface & Usability
------------------------
* Optimized panel layout for clearer information flow.
* Added panel location, theme, and font-size controls while keeping the panel visible by default.
* Added configurable label font size with Normal as the default.
* Added a Best View panel row to guide users toward the intended 4H / 1D interpretation profile.
* Added Auto Clean Sub-4H View to keep low-timeframe charts from becoming visually crowded.
------------------------
Behavior Notes
------------------------
This update does not change the core analytical purpose of the script.
The goal is to improve clarity and usability, not to introduce predictive behavior.
Users should interpret outputs the same way as before, but with improved visual structure, cleaner label density, centered pocket context, and stronger panel clarity.
The automatic sub-4H cleanup affects visual density only. It does not disable the core RSI failure swing confirmation engine.
------------------------
Limitations Reminder
------------------------
The script remains a rule-based analytical tool.
Market conditions such as volatility, liquidity, timeframe compression, RSI chop, and trend context may affect how failure swing sequences and trigger pockets 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.2This update focuses on readability and presentation.
The core purpose of the script remains unchanged. This release improves how the
existing RSI failure swing stages, confirmed trigger labels, trigger pockets,
and panel read on both light and dark chart 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
------------------------
- Pocket label moved off the candles
The trigger-pocket label now sits at the right edge of its pocket and stays
vertically centered, instead of floating in the middle of the pocket where it
could overlap candles and become hard to read.
- Theme-aware text everywhere
Stage labels, confirmed trigger labels, pocket labels, and panel values now
choose a text color that reads clearly on both light and dark backgrounds.
- Panel readability on both themes
Panel value colors were tuned so the RSI state, confirmation, pocket, and
best-view rows stay readable on the light theme as well as the dark theme.
------------------------
Visual Improvements
------------------------
- Pocket label sits at the right edge of its pocket, away from the candles.
- Contrast-safe stage, trigger, pocket, and panel text on both themes.
- Reduced overlap between pocket labels and price action.
- Preserved the familiar stage marker, trigger, and pocket layout.
------------------------
Interface & Usability
------------------------
- Cleaner, more readable pocket and trigger labeling.
- Improved panel contrast across all rows on both themes.
- 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.
The RSI failure swing sequence tracking, the stage transitions, the internal
RSI break confirmation, the trigger scoring, and the pocket projection 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 stages, triggers, and pockets 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.