OPEN-SOURCE SCRIPT
Actualizado

Volatility Shape Classifier [AGPro Series]

279
Volatility Shape Classifier [AGPro Series]

🔹 Overview

Volatility Shape Classifier is a context and diagnostics tool that does not stop at telling you whether volatility is high or low. Instead it classifies the SHAPE of that volatility on every bar — Smooth, Chaotic, Choppy, Drift, or Dead — using three independent dimensions combined into a single regime read. The result is a continuous visual narrative made of a subtle background tint, throttled transition badges, and a compact metrics panel.

It is designed to sit on your chart as a pure awareness layer. It does not generate buy or sell signals and it is not a trading strategy.


🔷 Unique Edge

Most volatility tools compress the market into one axis — high vs low (ATR, Bollinger Band Width), or trend vs range (Choppiness Index, ADX). They answer half of the question.

This script asks three questions at once and fuses the answers:

1. Magnitude — is ATR above or below its own long baseline?
2. Smoothness — are bar-to-bar moves consistent in size, or erratic?
3. Directional Consistency — do bars point the same way, or cancel each other?

Only the combination of these three can distinguish a controlled trend run (Smooth) from a violent whipsaw (Chaotic) from a wide directionless thrash (Choppy) — all three of which can show identical ATR readings. That shape distinction is the core value this script adds, and it is the gap left by standard volatility and chop indicators.


🔶 Methodology

Engine layer (per bar):
• Volatility Level = ATR(volLen) / SMA(ATR, volLen * 3)
• Smoothness = StDev(|close − close[1]|) / SMA(|close − close[1]|) over volLen
• Direction = |sum(close − close[1])| / sum(|close − close[1]|) over volLen

Classification layer maps the three readings into six mutually exclusive codes:
0 — Forming (warm-up / in-between space, no tint)
1 — Expansion · Smooth (high vol, low CV, directional)
2 — Expansion · Chaotic (high vol, high CV)
3 — Expansion · Choppy (high vol, low direction)
4 — Low-Vol · Drift (low vol, low CV, mild direction)
5 — Low-Vol · Dead (low vol, low CV, no direction)

Stability layer applies a configurable Confirmation Bars window so a new shape must persist for N consecutive bars before the chart commits to it. This prevents single-bar flicker. Between-state readings do not reset the current shape, they hold it — avoiding the classic "blink to neutral" problem of switch-based classifiers.


🔸 Signals & Alerts

Four alert conditions are published:
• Shape Shifted to Smooth Expansion
• Shape Shifted to Chaotic Expansion
• Shape Shifted to Choppy Expansion
• Shape Collapsed (any expansion state falling into low-vol Drift or Dead)

Alerts fire only on confirmed shape transitions and only on bar close, so repaint on the signal bar is not a concern.


🔹 Key Inputs

• Volatility Length — window for ATR, smoothness, and direction (default 20)
• Confirmation Bars — persistence requirement before committing to a new shape (default 3)
• Badge Cooldown — minimum bars between visible badges (default 15; tint updates continuously regardless)
• Panel Position / Size — six anchor points, four size presets
• Badge Font Size — four size presets


🔷 How to Use

• Use the SHAPE read as a setup filter, not as the signal itself. Smooth Expansion is where trend-following tools tend to perform well. Chaotic and Choppy Expansion are where they tend to fail even when the raw volatility reading looks attractive.
• The Drift state often precedes an expansion in the direction of the drift.
• The Dead state is a compression warning — a shape collapse alert from Expansion into Dead is a common precursor to a fresh expansion move in either direction.
• Pair with your own entry logic (structure, moving averages, volume). This tool answers "what kind of market am I in right now?" — it does not answer "where do I enter?"


🔶 Limitations & Transparency

• Thresholds (1.15x / 0.70x / 0.80 / 1.10 / 0.18) were tuned on crypto and FX data across 15m to 1D timeframes. Very illiquid instruments and very low timeframes (< 5m) may require a longer Volatility Length.
• Shape classification is inherently backward-looking (it reads the last volLen bars). It describes the character of recent volatility, not future volatility.
• The script is a context layer. It is not a strategy and should not be used in isolation for trade decisions.
• Past behavior of a shape does not guarantee future behavior.


🔸 Risk Disclosure

This indicator is an educational and analytical tool. It does not constitute financial advice, trade recommendations, or a signal service. All trading involves risk. You are solely responsible for your own trading decisions.
Notas de prensa
🔧 UPDATE NOTES - V2.2

This update focuses on readability, visual structure, chart clarity, and usability.

The core purpose of the script remains unchanged.
This release improves how the existing volatility-shape 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
------------------------

• Refined the publication identity
The script title now follows the updated AGPro Series naming standard while the panel title keeps the AG Pro brand format.

• Added a volatility-shape ribbon
The active shape is now shown through an ATR-scaled ribbon around an EMA backbone, giving the chart a clearer visual anchor.

• Added live right-edge state tags
The current volatility shape and quality score now remain visible on the right side of the chart without relying only on historical badges.

• Added a quality score
The panel and live tag now include a 0-100 quality reading derived from the active shape's core components.

• Improved confirmation controls
Classifier Mode, Confirmation Bars, and Badge Cooldown give users better control over responsiveness versus stability.


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

• Improved chart readability by replacing heavy background-only interpretation with a structured volatility ribbon

• Reduced visual clutter by limiting historical transition badges

• Refined visual hierarchy so the current state, quality score, and panel each have a distinct role

• Adjusted badge placement so transition labels sit outside candles

• Added subtle background tint as a secondary context layer rather than the main visual element


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

• Rebuilt the panel with the standard single merged blue header row

• Added configurable panel theme, panel position, panel font size, and label font size

• Reorganized the panel into Shape, Quality, Vol Level, Smooth / Dir, and Duration

• Added separate alert toggles for Smooth Expansion, Chaotic Expansion, Choppy Expansion, and Low-Volatility states

• Adjusted defaults for a balanced public screenshot: visible context without excessive label density


------------------------
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 and stronger regime context.


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

The script remains a rule-based analytical tool.

Market conditions such as liquidity, volatility spikes, timeframe differences, and abrupt regime transitions may affect how shapes 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.

Exención de responsabilidad

La información y las publicaciones no constituyen, ni deben considerarse como, asesoramiento o recomendaciones financieras, de inversión, de trading u otro tipo, proporcionadas o respaldadas por TradingView. Obtenga más información en Condiciones de uso.