OPEN-SOURCE SCRIPT
已更新

Volatility Contraction Pattern [AGPro Series]

1 900
Volatility Contraction Pattern [AGPro Series]


🧠 Core Idea

Is volatility contracting into a tighter and tighter base that is coiling toward a breakout pivot, and how high-quality is that setup?

This script is built to answer that one question with structure instead of guesswork.


📌 Overview / What It Does

Volatility Contraction Pattern is a breakout-readiness decision engine built around the classic VCP structure: a base where price pulls back in successive, progressively shallower contractions, coiling into a breakout pivot. It reads the swing structure as a zigzag, measures each contraction leg, and counts how many recent legs are tightening into the present.

From that it builds a single 0-100 readiness score by weighing four things: how many successive contractions are present, how tight the latest contraction is relative to ATR, whether the base sits inside a constructive trend, and whether volume is drying up into the base. It then marks the pivot breakout level at the most recent swing high, a tight invalidation at the latest contraction low, a measured-move target projected from the base height, and a clear next-action state.

It does NOT predict price, generate buy or sell signals, or automate trades. It organizes the base-and-breakout picture into a structured, scored read so a contraction setup is easier to recognize and plan around. Every output is analytical context, not a recommendation.


🎯 Purpose & Design Philosophy

Most breakout tools react to a single breakout bar after it prints, or they mark a generic low-volatility squeeze and leave the rest to interpretation. Far fewer frame the multi-contraction base as a staged, scored readiness with a defined pivot and a tight, structural risk reference.

This engine was built to fill that gap. It is for the patient trader who prefers to wait for a proper base to form rather than chasing every move, and who values a tight, well-defined risk reference. It supports a base-and-breakout mindset: let the contraction sequence develop, read how ready and how tight it is, mark the pivot and the invalidation, and let broader market context confirm or deny the idea. The aim is structured patience, not a shortcut around it.


⚡ Why This Script Is Different

Most tools mark a single squeeze state or fire the instant a breakout bar appears.

This script does NOT call the breakout, does NOT fire trade signals, and does NOT treat one tight bar as a setup.

Instead, it stages the whole contraction sequence. It counts successive tightening legs, measures current tightness in ATR, and resolves the base into a 0-100 readiness score with a pivot breakout level, a tight invalidation at the latest contraction low, and a measured-move target. The result is a calm, structured base read with a defined risk reference, rather than a backward-looking alert or a single-bar trigger.


⚙️ Methodology

1. Context Detection
An ATR baseline and an EMA trend backbone with a slope check describe the current environment.

2. Structure Mapping
Swing highs and lows are tracked as an alternating zigzag. The amplitude of each recent leg is measured to describe the contraction sequence.

3. Contraction Evaluation
The engine counts how many successive legs are tightening into the present, measures the latest contraction tightness against ATR, checks trend context, and reads volume dry-up. These combine into a single 0-100 quality score, and the base resolves into a state.

4. Visual Output
The base zone, pivot breakout level, tight invalidation, measured-move target, a centered readiness badge, and moderate state labels are rendered cleanly on the chart and in the panel.


🗺️ How to Read the Chart

- Base zone: a shaded box spanning the contraction base from its low to its high, tinted by the current state.
- Pivot line and tag: the breakout level at the most recent swing high, the trigger reference.
- Invalidation line and tag: the latest contraction low, the tight structural risk reference.
- Target line and tag: the measured-move objective projected from the base height above the pivot.
- Readiness badge: centered inside the base zone, showing the state and its 0-100 score.
- State labels: compact markers when the pattern enters Pivot Ready, Breakout, or Reset.
- Panel: a fixed readout of state, quality score, pivot, target, contractions and tightness, invalidation, and action.


🚦 Signals & States

- No Base: not enough structure to define a contraction base.
- Base Forming: a base is developing but not yet tight or built enough.
- Coiling: successive contractions are tightening and readiness is building.
- Pivot Ready: the base is tight and near the pivot, with a qualifying score.
- Breakout: price has moved beyond the pivot level.
- Reset: the base was invalidated below its risk reference.

These are interpretive states, not instructions. Pivot Ready does not mean buy; it means the base is tight and near its trigger in the current context.


🔔 Alerts Logic

Three optional alerts are available:
- Pivot Ready: triggers when the base becomes pivot-ready.
- Breakout: triggers when price moves beyond the pivot.
- Pattern Reset: triggers when the base is invalidated.

Alerts are attention markers that point you back to the chart for context. They are not trade instructions and carry no guarantee of any outcome.


🧩 Confluence Logic

The score is itself a confluence read. When the contraction count, the latest-leg tightness, the trend context, and the volume dry-up all agree, the score is higher and the base is more pronounced. When they disagree, the score stays moderate and the state often remains Base Forming, which is information in itself: the base is not yet a clean contraction.


📊 When to Use

- After a strong move, when price begins to base and contract rather than trend.
- In constructive consolidations where pullbacks are getting shallower.
- As a continuation-base overlay alongside your own structure and risk framework.
- On liquid symbols with enough swing history for the structure to form.


⚠️ When NOT to Use

- In choppy markets with no clear base structure.
- In very low-liquidity symbols or sessions, where swings are unreliable.
- In extremely noisy conditions, where levels are violated erratically.
- As a standalone entry trigger, or in isolation from market context and risk.


🎛️ Key Inputs

- Swing Strength and Swing Memory: how swings are detected and how many are retained.
- Base Swing Window: how many recent swings define the active base.
- Trend Backbone EMA and Slope Bars: the trend-context weighting.
- Use Volume Dry-Up and its windows: whether and how decreasing volume contributes.
- Tightness Scale: the ATR reference for scoring contraction tightness.
- Pivot-Ready Score, Pivot Proximity, Ready Tightness: thresholds that define a pivot-ready base.
- Visual, label, and panel controls: base zone, pivot, target and invalidation lines and tags, label density, panel location, theme, and font size.


🖥️ Interface & Visual Design

The panel is the primary readout, leading with the state and 0-100 score, then pivot, target, contractions and tightness, invalidation, and a concise action line. On the chart, the base zone anchors the structure, the pivot and invalidation give the trigger and the tight risk, and the measured-move target frames the objective. The readiness badge sits centered inside the base so the read is tied to the structure. Labels are kept moderate and fire only on state transitions so the chart stays clean. Panel location, theme, and font size are adjustable; the panel is shown by default for readability.


🧪 Practical Usage Workflow

1. Read the panel: note the state and the quality score.
2. Check contractions and tightness: how many tightening legs, and how tight now.
3. Watch the pivot: the breakout reference at the top of the base.
4. Note the invalidation and target: the tight risk reference and the measured objective.
5. Confirm with your own market structure, higher-timeframe context, and risk framework before any decision.


🔍 Interpretation Guidelines

Think of the read as a staged base readiness, not a forecast. A higher score means more successive contractions, tighter current price action, and better trend and volume context. A moderate score or a Base Forming state means the base is not yet clean and patience is warranted. The invalidation is a structural reference, not a hard line. Always interpret the base inside the broader market context rather than in isolation.


🚫 What This Script Is NOT

- It is NOT a prediction engine and does not forecast price direction.
- It is NOT financial advice or a recommendation to buy or sell.
- It is NOT an automated trading system.
- It does NOT produce guaranteed signals or outcomes.


⚠️ Limitations & Transparency

Outputs depend on detected swing structure and may differ across timeframes and symbols. Volatility, liquidity, and changing market conditions affect how bases form and how they resolve. A base can break out, fail, or simply drift; the engine describes current structure and cannot know the future. Any pivot can be exceeded or fail to be reached, and any base can be invalidated.


🧠 Market Context Notes

Bases tend to form after directional moves, as participants pause and pullbacks get shallower. Classic contraction structure pairs successively tighter pullbacks with drying volume, often inside a constructive trend. This engine encodes that logic into a single staged read, but broader market context always has the final word, and a tight base is a condition, not a promise.


🧾 Use Case Examples

- After a strong advance, price bases with two or three progressively tighter pullbacks: the engine moves from Base Forming to Coiling and may reach Pivot Ready near the pivot.
- Volume dries up into a tight base inside an uptrend: the quality score rises as contraction, tightness, trend, and volume align.
- Price breaks below the latest contraction low: the engine reports Reset, signaling the contraction structure has invalidated.


🧱 System Philosophy

This tool reflects the AGPro Series approach: convert a familiar but messy concept into a calm, structured, decision-support read. A contraction base is easy to misjudge by eye; the value is in staging it into an honest, scored read with a defined risk reference, while respecting the trader's own judgment rather than replacing it.


🔐 Non-Promise Statement

This script makes no promise of profit, accuracy, or any specific result. It is an analytical and organizational tool. No certainty is offered or implied.


📉 Risk Disclosure

Trading involves substantial risk, and most participants can lose money. This script is provided for educational and analytical purposes only and does not constitute financial advice. All decisions, positions, and outcomes remain entirely your own responsibility. Always manage risk and trade within your own plan.


📚 Educational Note

Used as intended, the engine can sharpen how you think about contraction bases: how many tightening legs are present, how tight the base has become, where the pivot and the risk sit, and what would invalidate the structure. Treat it as a lens for structured analysis, and keep building your own market understanding alongside it.
版本注释
UPDATE NOTES - v1.2

This update focuses on readability and on making the volatility-contraction
structure visible at a glance.

The core purpose of the script remains unchanged. The swing-based contraction
detection, the 0-100 readiness score, the pivot, target and invalidation logic
all behave the same way. This release improves how that structure is drawn and
read on the chart. It continues to function as an analytical and visualization
tool and does not attempt to predict price direction or guarantee outcomes.


------------------------
What Changed
------------------------

* Each contraction leg is now labeled with its depth.
A compact tag (C1, C2, C3 ...) is placed on each contraction low showing the
pullback depth as a percentage. This makes the defining VCP characteristic
visible: successive contractions getting progressively tighter into the pivot.

* The base box now wraps the actual coil.
Instead of a fixed swing window, the base is taken from the detected contraction
sequence (capped by the base-swing setting). The zone is tighter and reads as a
real contraction base rather than a wide range.

* More realistic measured-move target.
Because the base height is now measured across the actual coil, the projected
target is proportional to the contraction rather than an oversized projection.

* Cleaner, theme-aware presentation.
The readiness badge, contraction tags and panel stay readable on both dark and
light chart themes.


------------------------
Visual Improvements
------------------------

* Improved first-glance interpretation by drawing the tightening contraction
sequence directly on the chart.

* Reduced visual clutter by tightening the base box to the coil region.

* Refined visual hierarchy so the base zone, pivot, contraction depths and
targets each occupy their own space.

* Contraction depth tags are offset away from the candles for clean reading.


------------------------
Interface & Usability
------------------------

* Added a Show Contraction Depths setting (on by default) so the contraction
tags can be toggled.

* Repurposed the base-swing setting as a cap on how many swings the base can
span, keeping the control meaningful with the new coil-based base.

* All core engine inputs, scoring, alerts and defaults are preserved.


------------------------
Behavior Notes
------------------------

This update does not change the core analytical logic. Contraction detection,
readiness scoring, pivot, target and invalidation are unchanged. Only the
presentation and the base measurement window were refined. Users should
interpret outputs the same way as before, now with clearer visual structure.


------------------------
Limitations Reminder
------------------------

The script remains a rule-based analytical tool. Market conditions such as
volatility, liquidity, strong trends and timeframe differences may affect how
the base, contractions, pivot and target appear. Swings confirm after the swing
strength lookback, so structure appears after confirmation rather than in real
time. The pattern is most meaningful on a genuine contracting base, not on a
broad trending range.


------------------------
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提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。