Volatility Shape Classifier [AGPro Series]Volatility Shape Classifier
🔹 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 |) / SMA(|close − close |) over volLen
• Direction = |sum(close − close )| / sum(|close − close |) 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.
อินดิเคเตอร์ Pine Script®






















