OPEN-SOURCE SCRIPT
מעודכן Flag Continuation Zones [AGPro Series]

🔷 Flag Continuation Zones [AGPro Series]
Flag Continuation Zones is a premium bull flag and bear flag continuation engine designed to identify clean continuation structures without turning the chart into a generic breakout scanner.
The script focuses on a classic, highly recognizable price-action sequence:
impulse pole → controlled flag compression → qualified breakout → forward continuation zone
Instead of marking every small consolidation as a flag, the engine validates the structure through pole strength, travel efficiency, flag depth, channel compression, trend alignment, breakout distance, and optional volume participation.
🔷 What Makes This Different
Most flag indicators are visually simple but structurally loose. They often label shallow pauses, random pullbacks, or broad ranges as flags.
Flag Continuation Zones takes a stricter route.
It first requires a validated impulse pole. The move must be large enough relative to ATR and efficient enough to show directional commitment. After that, the script waits for a controlled counter-trend flag window. The flag must remain compact, avoid excessive retracement, and preserve continuation structure before any breakout is accepted.
This creates a chart experience that is more selective, cleaner, and easier to trust visually.
🔷 How The Engine Works
The script evaluates four core stages:
1. Pole Validation
The prior impulse is measured by ATR multiple and path efficiency. This helps separate real directional movement from noisy grinding price action.
2. Flag Compression
After the pole, the script studies the consolidation window. A valid flag must remain inside an acceptable depth and range relative to the pole.
3. Breakout Confirmation
A continuation event is accepted only when price clears the flag boundary with an ATR buffer and, when available, enough volume participation.
4. Continuation Mapping
Accepted structures create a forward rectangular zone, an impulse pole line, a breakout label, and an optional measured-move projection line.
🔷 Visual Design
The visual language is intentionally restrained:
- clean bull and bear flag labels
- rectangular continuation zones
- impulse pole reference lines
- optional measured-move target line
- trend EMA context
- compact AG Pro status panel
- adjustable panel location
- dark and light panel themes
- adjustable label and panel font sizes
The goal is to make the pattern visible and premium without crowding the chart.
🔷 How This Is Different From Other AGPro Tools
This script is not a generic Trend Continuation Quality tool. It is not an abstract continuation scorecard.
It is specifically built around the flag pattern family:
- impulse pole quality
- flag channel compression
- breakout through the flag boundary
- measured-move continuation context
It also avoids overlapping with triangle, consolidation breakout, Donchian breakout, inside-bar breakout, and trendline tools by staying focused on the pole-and-flag structure itself.
🔷 Best Fit
This script is useful for traders who want to scan for cleaner bull flag and bear flag continuation patterns across crypto, forex, stocks, indices, and futures.
It is especially suitable for:
- continuation traders
- breakout traders who want stricter structure
- price-action traders who follow classic chart patterns
- users who prefer rectangular zones and measured-move context
- traders who want fewer but higher-quality labels
🔷 Key Inputs
Important controls include:
- Pole Lookback
- Flag Window
- Minimum Flag Bars
- Minimum Pole ATR Multiple
- Minimum Pole Efficiency
- Maximum Flag Depth
- Maximum Flag Range
- Breakout Buffer
- Volume Confirmation
- Signal Cooldown
- Zone Forward Bars
- Label Font Size
- Panel Location
- Panel Theme
- Panel Font Size
🔷 In One Sentence
Flag Continuation Zones turns the classic bull flag and bear flag pattern into a cleaner, scored, zone-based continuation map built for premium public chart presentation.
Flag Continuation Zones is a premium bull flag and bear flag continuation engine designed to identify clean continuation structures without turning the chart into a generic breakout scanner.
The script focuses on a classic, highly recognizable price-action sequence:
impulse pole → controlled flag compression → qualified breakout → forward continuation zone
Instead of marking every small consolidation as a flag, the engine validates the structure through pole strength, travel efficiency, flag depth, channel compression, trend alignment, breakout distance, and optional volume participation.
🔷 What Makes This Different
Most flag indicators are visually simple but structurally loose. They often label shallow pauses, random pullbacks, or broad ranges as flags.
Flag Continuation Zones takes a stricter route.
It first requires a validated impulse pole. The move must be large enough relative to ATR and efficient enough to show directional commitment. After that, the script waits for a controlled counter-trend flag window. The flag must remain compact, avoid excessive retracement, and preserve continuation structure before any breakout is accepted.
This creates a chart experience that is more selective, cleaner, and easier to trust visually.
🔷 How The Engine Works
The script evaluates four core stages:
1. Pole Validation
The prior impulse is measured by ATR multiple and path efficiency. This helps separate real directional movement from noisy grinding price action.
2. Flag Compression
After the pole, the script studies the consolidation window. A valid flag must remain inside an acceptable depth and range relative to the pole.
3. Breakout Confirmation
A continuation event is accepted only when price clears the flag boundary with an ATR buffer and, when available, enough volume participation.
4. Continuation Mapping
Accepted structures create a forward rectangular zone, an impulse pole line, a breakout label, and an optional measured-move projection line.
🔷 Visual Design
The visual language is intentionally restrained:
- clean bull and bear flag labels
- rectangular continuation zones
- impulse pole reference lines
- optional measured-move target line
- trend EMA context
- compact AG Pro status panel
- adjustable panel location
- dark and light panel themes
- adjustable label and panel font sizes
The goal is to make the pattern visible and premium without crowding the chart.
🔷 How This Is Different From Other AGPro Tools
This script is not a generic Trend Continuation Quality tool. It is not an abstract continuation scorecard.
It is specifically built around the flag pattern family:
- impulse pole quality
- flag channel compression
- breakout through the flag boundary
- measured-move continuation context
It also avoids overlapping with triangle, consolidation breakout, Donchian breakout, inside-bar breakout, and trendline tools by staying focused on the pole-and-flag structure itself.
🔷 Best Fit
This script is useful for traders who want to scan for cleaner bull flag and bear flag continuation patterns across crypto, forex, stocks, indices, and futures.
It is especially suitable for:
- continuation traders
- breakout traders who want stricter structure
- price-action traders who follow classic chart patterns
- users who prefer rectangular zones and measured-move context
- traders who want fewer but higher-quality labels
🔷 Key Inputs
Important controls include:
- Pole Lookback
- Flag Window
- Minimum Flag Bars
- Minimum Pole ATR Multiple
- Minimum Pole Efficiency
- Maximum Flag Depth
- Maximum Flag Range
- Breakout Buffer
- Volume Confirmation
- Signal Cooldown
- Zone Forward Bars
- Label Font Size
- Panel Location
- Panel Theme
- Panel Font Size
🔷 In One Sentence
Flag Continuation Zones turns the classic bull flag and bear flag pattern into a cleaner, scored, zone-based continuation map built for premium public chart presentation.
הערות שחרור
UPDATE NOTES - V1.3This update focuses on readability, visual hierarchy, label balance, panel structure, and cleaner flag-continuation interpretation.
The core purpose of the script remains unchanged.
This release improves how the existing bull flag and bear flag continuation 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 flag-zone visual system.
The script still evaluates impulse pole strength, pole efficiency, controlled flag depth, channel compression, breakout distance, and optional volume participation.
* Added centered labels inside flag zones.
Qualified bull flag and bear flag zones now include compact centered labels so the zone itself communicates direction and quality.
* Rebalanced default label density.
Setup labels remain visible by default because flag charts need enough visual activity to communicate the pattern quickly. Centered zone labels add context without replacing the classic setup/breakout markers.
* 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 secondary labels, target retention, and historical zone count by default while the core flag engine 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 flag zones, centered labels, pole lines, breakout labels, measured-move targets, and panel contrast.
* Reduced visual clutter to enhance first-glance interpretation.
* Refined visual hierarchy so setup zones, breakout labels, pole anchors, and target projections are easier to separate.
* Adjusted label placement to avoid overlap with candles by using ATR-based spacing.
* Added centered labels inside flag-continuation zones.
------------------------
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 while preserving setup labels and target context.
------------------------
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 zone context, and stronger panel clarity.
The automatic sub-4H cleanup affects visual density only. It does not disable the core flag setup or breakout engine.
------------------------
Limitations Reminder
------------------------
The script remains a rule-based analytical tool.
Market conditions such as volatility, liquidity, timeframe compression, news gaps, and trend quality may affect how flag setups and breakouts 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.
הערות שחרור
🔧 UPDATE NOTES - V3.1This update focuses on chart readability, label discipline, and visual balance.
The core purpose of the script remains unchanged.
This release improves how the existing flag-continuation workflow 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
------------------------
• Controlled label-density behavior
The script now uses stricter default spacing for setup, breakout, and pole labels so active charts remain readable without becoming visually empty.
• One setup label per active flag candidate
Qualified setup context is now printed once per active candidate instead of repeating during the same continuation review.
• Major pole label filtering
Pole labels now appear only on stronger impulse anchors by default, reducing low-value pole labels on intraday charts while preserving important context.
• Shorter live watch projection
Live watch zones now project more compactly to the right, improving first-glance structure and reducing oversized active boxes.
• Unified label sizing preserved
All chart labels continue to use the same user-selected label font size for a cleaner and more consistent visual presentation.
------------------------
Visual Improvements
------------------------
• Reduced overlapping Pole / Setup / Break label clusters
• Improved chart readability on 15m, 30m, 1H, 4H, 1D, and 1W views
• Preserved meaningful label presence without turning the chart into a sparse pattern printer
• Refined visual hierarchy so zones, pole lines, setup labels, breakout labels, and targets feel more intentional
------------------------
Interface & Usability
------------------------
• Kept the same panel layout, theme controls, location controls, and font-size controls
• Kept the same label-size control for all chart labels
• Adjusted default visual settings for a more balanced publication view
• Improved the lower-timeframe user experience without removing existing features
------------------------
Behavior Notes
------------------------
This update does not remove the core analytical workflow 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 better visual structure and fewer repeated labels.
------------------------
Limitations Reminder
------------------------
The script remains a rule-based analytical tool.
Market conditions such as volatility, liquidity, and timeframe differences may affect how continuation structures 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.
הערות שחרור
🔧 UPDATE NOTES - v3.2This update focuses on decision confidence and proof.
The core purpose of the script remains unchanged.
This release adds a confirmation-anchored proof layer that measures how often confirmed flag
breakouts continued toward the measured move before the flag boundary was lost.
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 a Proof Layer (Follow / Hold / React / Flip)
The panel now reports how reliably confirmed flag breakouts continued on the current symbol
and timeframe. Each time a breakout confirms, it is tracked forward over a configurable
horizon with the breakout close as the entry, the opposite flag boundary as the risk
reference, and a one risk unit (1R) target toward the measured move:
- Follow Rate : share of breakouts that continued one risk unit toward the measured move
(or reached a nearer target) before the flag boundary was lost
- Hold Rate : share whose flag boundary was not lost through resolution
- React Rate : share that produced an early favorable continuation reaction
- Flip Rate : share whose flag boundary was lost within the horizon (the continuation
failed)
A sample size (n) is shown so the rates are read in context, and they display as "building"
only until the first breakout resolves.
• Added an Action row to the panel
The panel now surfaces the decision-language action state (monitor compression, review setup,
review breakout, review target) that the engine already tracks, replacing the previous
view-hint row for a more focused, decision-first dashboard.
• Added hidden data outputs
The Follow / Hold / React / Flip rates are now added to the hidden plot outputs alongside the
existing quality-score and candidate-side values, so they can be referenced by alerts,
screeners, or other tools without changing the chart visuals.
------------------------
Visual Improvements
------------------------
• Grouped the proof metrics into a clean block under a dedicated "Proof @ Confirm" heading,
below the existing side, phase, pole, flag-depth, quality, and action rows.
• Preserved the existing continuation zones, live watch zone, impulse pole lines and labels,
setup and breakout labels, measured-move target lines, and right-side target tags.
• Kept the merged blue header row and alternating-row dashboard styling across the dark and
light themes.
------------------------
Interface & Usability
------------------------
• Optimized panel layout for clearer information flow with the new action row and proof block.
• Improved at-a-glance interpretation by reporting how often confirmed breakouts continued
toward the measured move before the flag boundary was lost.
• Adjusted default visual settings for a more balanced appearance.
• Added a Proof input group (show/hide, proof horizon bars, reaction window bars, reaction
progress threshold) so the proof layer is fully configurable without affecting the core
flag detection engine.
------------------------
Behavior Notes
------------------------
This update does not change the core analytical logic of the script.
The proof rates are descriptive statistics of confirmed flag breakouts on the current symbol
and timeframe. They measure how often a breakout continued one risk unit toward the measured
move before the flag boundary, not trade performance, and they do not change how the quality
score, side, phase, zones, or targets are produced.
Users should interpret outputs the same way as before, now with added reliability context.
------------------------
Limitations Reminder
------------------------
The script remains a rule-based analytical tool.
Proof rates depend on the amount of available history and on how many flag breakouts occurred
on the current symbol and timeframe; a small sample (low n) should be treated with caution.
Each breakout is counted once, with the breakout-close entry, flag-boundary risk, and 1R
measured-move target frozen at confirmation. Continuation structure is clearest on the higher
timeframes the script is designed for. Market conditions such as volatility, liquidity, and
timeframe differences may affect how breakouts and rates 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.
סקריפט קוד פתוח
ברוח האמיתית של TradingView, יוצר הסקריפט הזה הפך אותו לקוד פתוח, כך שסוחרים יוכלו לעיין בו ולאמת את פעולתו. כל הכבוד למחבר! אמנם ניתן להשתמש בו בחינם, אך זכור כי פרסום חוזר של הקוד כפוף ל־כללי הבית שלנו.
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
כתב ויתור
המידע והפרסומים אינם מיועדים להיות, ואינם מהווים, ייעוץ או המלצה פיננסית, השקעתית, מסחרית או מכל סוג אחר המסופקת או מאושרת על ידי TradingView. קרא עוד ב־תנאי השימוש.
סקריפט קוד פתוח
ברוח האמיתית של TradingView, יוצר הסקריפט הזה הפך אותו לקוד פתוח, כך שסוחרים יוכלו לעיין בו ולאמת את פעולתו. כל הכבוד למחבר! אמנם ניתן להשתמש בו בחינם, אך זכור כי פרסום חוזר של הקוד כפוף ל־כללי הבית שלנו.
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
כתב ויתור
המידע והפרסומים אינם מיועדים להיות, ואינם מהווים, ייעוץ או המלצה פיננסית, השקעתית, מסחרית או מכל סוג אחר המסופקת או מאושרת על ידי TradingView. קרא עוד ב־תנאי השימוש.