AG Pro Value Migration Bands [AGPro Series]AG Pro Value Migration Bands
Overview / What it does
The "AG Pro Value Migration Bands" script is a chart-first analytical tool designed to visualize how the market's accepted-value region migrates over time. Instead of drawing a single average line, it builds a three-layer band (upper, middle, lower) that represents where price has been most accepted during the rolling lookback window. As this band drifts up, holds flat, or drifts down, the indicator classifies the environment into three structural regimes: Rising Value, Flat Value, and Falling Value. The script's goal is to help traders read structural direction at a glance — not entry signals — by turning the abstract concept of value migration into a single, dominant on-chart geometry.
Unique Edge (Why it is not a basic mashup)
This script is not a moving average envelope, a Keltner-style ATR band, a Bollinger Band, or a volume profile derivative. It introduces three distinct design choices that work together:
First, the band itself is constructed from percentile-window statistics rather than from mean-plus-deviation logic. The upper and lower edges are the linear-interpolation percentiles of a typical-price series over the lookback, which captures the region where price has statistically spent the most time — the structural meaning of "accepted value."
Second, the migration classification is ATR-normalized, making the Rising / Flat / Falling regime scale-invariant across assets and timeframes. A 2-bar candidate confirmation layer prevents the regime from flipping on single-bar noise.
Third, the visual identity is engineered around a single dominant band with a low-opacity fill. Event markers (Reclaim / Lost) are regime-gated and ATR-distance-gated to prevent label spam, so the chart stays clean even in choppy markets.
Methodology (Conceptual Data Flow)
1. Percentile Band Construction: For each bar, the script computes the low-percentile and high-percentile of the typical price (HLC/3) over the user-defined Band Length. The Band Width Mode (Tight / Balanced / Wide) controls which percentile pair is used.
2. Light Smoothing: The raw percentile edges are lightly smoothed with an EMA whose length scales with the Band Length, stabilizing the band visually without introducing structural lag.
3. Strict Value Filter: When the band width collapses below 0.8 ATR, the band is treated as a compressed non-structural zone and the regime is forced to Flat. This eliminates trivial micro-bands.
4. Migration Slope: The slope of the middle line is measured over a rolling window and normalized by ATR, producing a scale-invariant slope coefficient.
5. Regime Classification: The ATR-normalized slope is compared to the user's Sensitivity threshold to produce a candidate regime (Rising / Flat / Falling). A 2-bar persistence check confirms the regime before it commits.
6. Location State: Price is continuously classified as Inside, Above, or Below the band.
7. Event Gating: Reclaim and Lost events are only emitted when the current regime makes that event structurally meaningful (Reclaim only when not Falling; Lost only when not Rising), and only after a minimum ATR-distance from the prior event.
Signals and Alerts
All alerts are deterministically defined based on strict mathematical conditions. For optimal stability, alerts should be configured to trigger on "Once Per Bar Close."
- VMB: Value Band Shifted Up — Triggers when the confirmed regime transitions into Rising Value.
- VMB: Value Band Shifted Down — Triggers when the confirmed regime transitions into Falling Value.
- VMB: Band Reclaimed — Triggers when price returns into the accepted-value region from below, and the regime is not Falling (regime-gated).
- VMB: Band Lost — Triggers when price falls out of the accepted-value region from inside, and the regime is not Rising (regime-gated).
Key Inputs
- Band Length — Lookback window used to build the rolling accepted-value region. Default 100 is balanced for 1H–4H swing use.
- Band Width Mode — Tight / Balanced / Wide. Controls which percentile pair defines the band edges.
- Strict Value Filter — When enabled, forces Flat regime during extreme band compression (recommended ON).
- Migration Slope Sensitivity — ATR-normalized slope threshold separating Rising / Flat / Falling.
- Show Midline, Band Fill, State Label, Event Markers, Info Panel — Individual visual toggles for a configurable display.
- Panel Font Size, Label Font Size — Separate font-size controls for the info panel and on-chart labels.
- Rising / Falling / Flat Colors, Band Fill Opacity — Full color customization.
How to use
This indicator is designed as a structural context tool, not an entry system. It is most useful for identifying the dominant value-migration direction and filtering trade ideas against that context.
- A persistent Rising Value regime with price repeatedly holding inside or above the band suggests a structurally constructive environment where long-biased setups from other tools carry a contextual tailwind.
- A persistent Falling Value regime with price repeatedly losing the band suggests a structurally weak environment where short-biased setups carry a contextual tailwind.
- A Flat Value regime with a Tight Band Width is a signal of compression; the indicator makes no directional claim in this state and the user should defer to breakout or range-trading tools.
- Reclaim and Lost event markers are reference points for location transitions, not standalone entry signals. They are most useful as confluence with independent structure, liquidity, or volume analysis.
- The info panel's four rows (Value State, Migration, Location, Band Width) are designed to be read in roughly two seconds and provide a complete snapshot of the current structural context.
Limitations & Transparency
The band is built from percentile statistics over a finite lookback window. This means the band will lag in absolute terms after sharp regime changes, and the structure will always re-stabilize only after enough post-shift data has accumulated. The Migration Slope is a historical measurement, not a forecasting tool — it describes what has happened, not what will happen next.
The Strict Value Filter uses a fixed 0.8 ATR compression threshold that has been tuned for general crypto and equity behavior; in extremely low-volatility or very thinly-traded markets, users may wish to disable the filter or adjust the lookback. This script does not use request.security() and therefore does not carry any multi-timeframe repainting risk.
Regime classification is deterministic and closes-only at the candle-close level, but during live bar development the classification can flicker before the bar closes. For stable reading, always evaluate the regime on closed bars.
What It Is Not & Risk Disclosure
This indicator is not a standalone trading strategy, not an automated bot, and does not provide buy or sell recommendations. There is no such thing as a guaranteed win rate or a perfect indicator. Not financial advice. Past performance is not indicative of future results. Do your own research and testing before making any trading decisions.
مؤشر Pine Script®






















