Darvas Box Breakout Quality [AGPro Series]Darvas Box Breakout Quality
🔹 OVERVIEW
Darvas Box Breakout Quality is built for one of the most recognizable and widely searched chart-pattern structures in technical analysis: the Darvas Box.
The script focuses on the full Darvas lifecycle:
Box formation → compression quality → breakout direction → volume support → failed-break behavior.
Instead of treating every horizontal range as support and resistance, this script waits for a Darvas-style structure to form, validates the box by age and volatility-adjusted height, then evaluates how price resolves from that box. The result is a clean chart-pattern workflow designed for traders who want to study rectangular compression and breakout quality without turning the chart into a crowded zone map.
The main visual element is the active Darvas box itself. By default, resolved boxes are removed after breakout so the chart stays focused on the current live structure instead of filling with old rectangles.
🔹 WHAT MAKES IT DIFFERENT
Most box or breakout tools stop at drawing a rectangle or marking the first break beyond a level. Darvas Box Breakout Quality adds structure, scoring, and failure awareness.
Core differentiators:
• Darvas-first structure logic
The rectangle is not a generic support/resistance zone. It comes from a Darvas box formation process built around a fresh seed high, containment, age, and volatility-adjusted box height.
• Compression quality
The script measures whether the box has enough maturity and controlled range behavior before treating it as a meaningful active structure.
• Breakout quality score
Every qualified breakout is evaluated with a 0-100 model that includes compression quality, relative volume, breakout distance, candle body participation, and directional close location.
• Volume confirmation
Breakout labels can require volume support, helping separate stronger participation events from weaker boundary pokes.
• Failed-break tracking
After breakout, the script watches whether price returns back inside the former box within the selected failure window. If it does, the event is marked as a failed break.
• Premium visual restraint
The default chart view uses one active box, compact labels, controlled label spacing, and a compact AGPro panel. The goal is to make the chart informative without making it noisy.
🧭 WHY THIS DOES NOT OVERLAP WITH OTHER AGPRO TOOLS
This script is intentionally separated from the existing AGPro breakout and chart-pattern family.
It is not Inside Bar Breakout Quality, because it does not require a mother bar or inside-bar compression sequence.
It is not Donchian Breakout Quality, because it is not based on rolling channel highs and lows.
It is not Opening Range Breakout logic, because it is not tied to a session-defined range.
It is not Triangle Breakout Quality, because it does not use converging pivot boundaries, apex pressure, or diagonal structure.
It is not Breakout Volume Quality, because volume is only one part of the confirmation model, not the entire concept.
It is not a supply/demand, order-block, or generic support/resistance zone script. The rectangle exists only when the Darvas box formation process supports it.
That distinction matters visually and analytically. On the chart, this script tells a Darvas story: rectangular compression, active box behavior, quality of release, and failed-break review.
⚙️ METHODOLOGY
1. Darvas seed detection
The script looks for a fresh high over the selected lookback period. This high becomes the initial reference for a potential Darvas box.
2. Box formation
After the seed appears, price must spend enough time contained beneath the upper boundary while the lower boundary develops. The box remains in formation until it meets the selected age and height requirements.
3. Volatility normalization
The box height is measured relative to ATR. This helps filter boxes that are too flat to matter or too wide to represent clean compression.
4. Active box state
When the box qualifies, the script displays the active Darvas box and optional midpoint. The box projects forward so the active breakout boundary remains visible while price approaches it.
5. Breakout confirmation
A bullish breakout requires price to resolve above the Darvas top. A bearish breakout requires price to resolve below the Darvas bottom. Users can require close-based confirmation for stricter filtering.
6. Quality score
The breakout score combines:
• Compression quality
• Relative volume support
• ATR-normalized breakout distance
• Candle body participation
• Directional close location
7. Failed-break monitoring
After breakout, the script watches a defined number of bars. If price returns back inside the former Darvas boundary, the failed-break marker is printed.
📊 PANEL
The AGPro panel summarizes the current Darvas environment:
• Box Age
• Compression
• Breakout Side
• Volume Support
• Latest Quality / State
The first panel row follows the AGPro publication standard: one merged blue header row containing only the panel title. Panel location, panel theme, and panel font size are adjustable from settings.
🎛️ KEY INPUTS
Darvas Box Detection
• New High Lookback
• Minimum Box Age
• Maximum Box Age
• ATR Length
• Minimum Box Height ATR
• Maximum Box Height ATR
• Require Close Beyond Box
Breakout Quality
• Volume MA Length
• Volume Support Threshold
• Require Volume Support
• Target Break Distance ATR
• Minimum Breakout Score
• Failed Break Window
Visual Controls
• Show Active Darvas Box
• Show Box Midline
• Show Breakout Labels
• Show Failed Break Markers
• Keep Resolved Box
• Box Projection Bars
• Label Cooldown Bars
• Maximum Visible Labels
• Label Offset ATR
• Label Stack Offset ATR
• Label Font Size
Panel
• Panel Location
• Panel Theme
• Panel Font Size
🔍 HOW TO READ IT
When a Darvas box becomes active, the chart displays the live rectangular structure. The panel shows how old the box is, how compressed it is, and whether the latest environment has breakout direction or volume support.
When price resolves outside the box with enough quality, the chart prints a compact breakout label such as UP 79 or DN 75. The number represents the breakout quality score.
When price fails to hold outside the box and returns back inside during the selected failure window, the script prints a compact failed-break marker such as FAIL UP or FAIL DN.
The best readings come when the box is visually clear, compression is meaningful, and the breakout candle has both directional close quality and volume support.
🧩 BEST USE CASES
• Classic Darvas box formations
• Rectangular range compression
• Box breakout quality review
• Volume-backed breakout confirmation
• Failed-break review after a box release
• Clean chart-pattern study
• Multi-timeframe Darvas structure observation
• Screenshot-friendly public chart analysis
🧠 VISUAL DESIGN PHILOSOPHY
Darvas Box Breakout Quality is designed to look premium through restraint.
The script avoids filling the chart with old boxes by default. It keeps the active Darvas box as the main visual layer, uses short event labels, adds cooldown and stack spacing to reduce overlap, and keeps the panel compact.
This makes the indicator easier to publish, easier to read, and easier to use across different symbols and timeframes.
🔔 ALERTS
The script includes alert conditions for:
• High-quality bullish Darvas breakout
• High-quality bearish Darvas breakout
• Failed bullish Darvas breakout
• Failed bearish Darvas breakout
These alerts follow the same structure-aware logic used by the chart labels.
🔹 LIMITATIONS AND TRANSPARENCY
Darvas box detection is structure-based and depends on the selected lookback, age, and ATR filters. Changing those settings can make the script more selective or more active.
Volume support depends on the quality of the symbol's volume feed. On instruments where volume is less informative, users may prefer to adjust the volume threshold or disable the volume requirement.
The score is a structured description of breakout quality according to the script's internal model. It is designed to help compare Darvas box releases by quality, not to replace the user's broader market context.
✅ IDEAL USER
This script is designed for traders who want a focused Darvas box tool with cleaner structure detection, breakout quality scoring, volume confirmation, failed-break awareness, and a premium chart layout.
It is best suited for users who want the Darvas box itself to remain the main story on the chart.
Pine Script®指标






















