Echelon Regime Gauge [JOAT]Echelon Regime Gauge
Introduction
The Echelon Regime Gauge is an open-source market regime detection and session awareness indicator built in Pine Script v6. It classifies the current market state into one of six regimes — Trend Up, Trend Down, Range, Volatile, Squeeze, or Mixed — using a combination of SMA alignment, VWAP slope analysis, and Bollinger Band volatility metrics. On top of regime detection, the indicator provides session identification (Asian, London, New York, Kill Zones, Power Hour), volatility state tracking (Expansion, Contraction, Squeeze), R-squared trend quality measurement, historical volatility percentile, Wyckoff effort/result analysis, and an institutional activity score that colors candles by multi-factor heatmap logic.
The core question this indicator answers is: "What kind of market am I in right now?" Knowing whether the market is trending, ranging, squeezing, or volatile changes everything about how you should trade — from entry type to stop placement to position sizing. This indicator provides that context in real-time with a confidence percentage and a comprehensive HUD dashboard.
Why This Indicator Exists
Most traders apply the same strategy regardless of market conditions. A breakout strategy in a ranging market produces whipsaws. A mean-reversion strategy in a trending market produces losses. This indicator solves the context problem by providing a clear, quantified regime classification:
Regime Detection: Six distinct market states, each requiring different trading approaches. The classification uses three independent inputs — SMA alignment, VWAP slope direction, and Bollinger Band percentile — to produce a robust, multi-factor regime reading.
Regime Confidence: A 0-100 score indicating how clearly the market fits the detected regime. High confidence means the classification is strong and reliable. Low confidence suggests transitional or ambiguous conditions.
Session Awareness: Identifies the current trading session (Asian, London, New York) and highlights Kill Zones (London 2-5am, NY 7-10am) and Power Hour (3-4pm) — the periods when institutional activity is highest and moves are most significant.
Volatility State: Tracks whether volatility is in Expansion, Contraction, Squeeze, or Normal state. Squeeze conditions (Bollinger width in the bottom 10th percentile) often precede explosive moves.
Trend Quality (R-Squared): Measures how linear and clean the current trend is on a 0-1 scale. R-squared above 0.6 indicates a clean, tradeable trend. Below 0.4 indicates choppy, random price action.
Institutional Activity Score: A multi-factor score (0-100) computed from body ratio, volume ratio, R-squared, Bollinger Band position, and VWAP distance. This score drives the candle heatmap coloring.
How Regime Detection Works
The regime engine combines three independent analytical dimensions:
Dimension 1 — SMA Alignment:
The indicator calculates three Simple Moving Averages (default 20, 50, 200). When all three are aligned in order (20 > 50 > 200), the market is in bull alignment. When reversed (20 < 50 < 200), bear alignment. Any other configuration is diverged/mixed.
Dimension 2 — VWAP Slope:
The VWAP (Volume Weighted Average Price) slope is calculated over a configurable lookback and normalized by ATR to make it comparable across instruments. A normalized slope above the threshold indicates upward momentum. Below the negative threshold indicates downward momentum. Within the threshold band indicates flat/ranging conditions.
Dimension 3 — Volatility Percentile:
Bollinger Band width percentile rank over 120 bars determines volatility state. Below the 10th percentile is a squeeze. Above the configurable expansion percentile (default 75th) is expansion. ATR percentile rank provides a secondary volatility measure.
These three dimensions combine into the regime classification:
Squeeze: BB width in bottom 10th percentile — volatility compression, potential breakout imminent
Trend Up: Bull SMA alignment AND positive VWAP slope — clear directional momentum upward
Trend Down: Bear SMA alignment AND negative VWAP slope — clear directional momentum downward
Volatile: ATR in expansion percentile WITHOUT SMA alignment — high volatility but no clear trend direction
Range: Flat VWAP slope WITHOUT SMA alignment — sideways, mean-reverting conditions
Mixed: Conditions do not clearly fit any category — transitional state
Regime Confidence Calculation
Each regime has its own confidence formula based on how strongly the inputs support the classification:
Trend Up/Down: SMA alignment (40pts) + slope direction (30pts) + slope magnitude (up to 30pts)
Range: Flat slope (40pts) + no alignment (30pts) + low ATR percentile (up to 30pts)
Squeeze: Low BB percentile (70%) + low ATR percentile (30%)
Volatile: High ATR percentile (70%) + high BB percentile (30%)
Mixed: Fixed at 25 — low confidence by definition
The confidence is displayed as both a number and a visual bar (||||......) in the HUD, making it easy to assess at a glance.
Session and Time-of-Day Analysis
The indicator identifies seven session states with configurable timezone (default America/New_York):
Asia (7pm-3am): Low volatility, range-building session. Quality: Low.
London (3am-9:30am): Increasing volatility, often sets the day's direction. Quality: Medium.
London Kill Zone (2-5am): Peak London institutional activity. Quality: High.
New York (9:30am-4pm): Highest volume session for US instruments. Quality: Medium.
NY Kill Zone (7-10am): Peak NY institutional activity, overlap with London. Quality: High.
Lunch (10am-12pm): Low conviction, choppy price action. Quality: Low.
Power Hour (3-4pm): End-of-day positioning, often produces strong moves. Quality: High.
Kill Zones are highlighted with a subtle gold background tint. Lunch hours receive a dark tint as a visual warning of low-quality conditions.
Institutional Signal System
The indicator detects and labels six types of institutional events using a priority-based system with cooldowns to prevent label stacking:
P1 — BULL/BEAR CONFLUENCE (highest priority): Full alignment of SMA, VWAP slope, R-squared trend quality, regime confidence > 70, and price vs VWAP. This is the strongest possible directional signal — all factors agree.
P2 — MAJOR GOLDEN/DEATH CROSS: Mid SMA (50) crosses the Slow SMA (200). These are rare, high-impact structural events that signal major trend shifts.
P2b — GOLDEN X / DEATH X: Fast SMA (20) crosses Mid SMA (50). More frequent than major crosses but still significant structural events.
P3 — REGIME CHANGE: The regime classification changes from one state to another. Labels show the new regime name.
P4 — SQZ BREAK: Squeeze releases into expansion with price above (bull) or below (bear) the fast SMA. These are high-energy breakout events.
P5 — VWAP RECLAIM/REJECT: Price crosses above VWAP with positive slope (reclaim) or below with negative slope (rejection). VWAP is the institutional benchmark — reclaiming or losing it is significant.
P6 — DISP (Displacement, lowest priority): Large-body candles (body > 70% of range, body > 2x average) indicating aggressive institutional order flow.
Each signal checks a cooldown counter before firing. Higher-priority signals suppress lower-priority ones within the cooldown window, ensuring the chart shows only the most important signal at any given time.
Candle Heatmap Coloring
When enabled, candles are colored based on the current regime and trend quality rather than simple bull/bear direction:
Bull Aligned + Clean Trend: Bright aurora lime (bullish candles) / aurora green (bearish candles)
Bull Aligned: Aurora green / aurora teal
Bear Aligned + Clean Trend: Aurora pink / aurora purple
Bear Aligned: Aurora purple / aurora pink
Squeeze: Aurora gold / warm orange
Neutral: Ice blue / arctic blue
This coloring scheme makes it immediately obvious what regime the market is in without looking at the HUD — the entire chart changes character with the regime.
Advanced Metrics
R-Squared Trend Quality: Calculated as the square of the correlation between close price and bar_index over a configurable period. Values above 0.7 indicate a clean, linear trend. Values below 0.4 indicate choppy, non-directional price action. This metric helps distinguish between trending markets that are tradeable and trending markets that are too choppy to trade reliably.
Historical Volatility: Annualized standard deviation of log returns, displayed as a percentage with percentile ranking over 252 bars. This provides a longer-term volatility context beyond the Bollinger-based squeeze detection.
Wyckoff Effort/Result: Volume divided by range — when this ratio is high (high volume, small range), institutional absorption is occurring. The indicator detects these events and displays them in the HUD.
Regime Duration: Counts how many bars the current regime has persisted. Long-duration regimes are more established. Short-duration regimes may be transitional.
Institutional Score: A 0-100 composite from body ratio, volume ratio, R-squared, BB position extremes, and VWAP distance. Higher scores indicate more institutional-quality price action.
HUD Dashboard
The HUD displays 12 metrics with color-coded values:
Regime State with regime-specific color
Confidence score with visual bar (||||......)
VWAP Slope direction (Rising/Falling/Flat)
Volatility state with squeeze duration counter
Current Session name
Session Quality rating (High/Medium/Low)
SMA Alignment (Bull Aligned/Bear Aligned/Diverged)
R-Squared trend quality (Clean/Moderate/Choppy)
Historical Volatility with percentile classification
Regime Duration in bars
Institutional Activity Score
Input Parameters
Regime Detection:
Fast/Mid/Slow SMA: Moving average periods (default: 20/50/200)
VWAP Slope Lookback: Period for slope calculation (default: 20)
Slope Threshold: Normalized slope threshold for trend detection (default: 0.12)
Volatility:
ATR Length: Period for ATR calculation (default: 14)
Bollinger Length/Multiplier: BB parameters (default: 20/2.0)
Squeeze Lookback: Percentile rank period (default: 120)
Expansion Percentile: ATR percentile threshold for expansion (default: 75)
Sessions:
Show Session Zones: Toggle session background highlighting
Timezone: Configurable timezone (default: America/New_York)
Highlight Kill Zones: Toggle kill zone emphasis
Visual:
Regime Background: Toggle regime-adaptive background tinting
SMA Trend Ribbon: Toggle ribbon fill between fast and mid SMA
Candle Heatmap Coloring: Toggle institutional activity-based candle colors
Show Prior Day H/L: Toggle PDH/PDL reference lines
HUD Panel: Toggle with configurable position
How to Use This Indicator
Step 1: Check the Regime
Before entering any trade, check what regime the market is in. Trend Up/Down = directional strategies. Range = mean-reversion. Squeeze = wait for breakout. Volatile = reduce size or stand aside.
Step 2: Verify Confidence
A regime reading with 80+ confidence is reliable. Below 50 suggests the market is in transition — be cautious.
Step 3: Check the Session
Kill Zones and Power Hour produce the most reliable moves. Lunch hour and Asian session moves are less reliable for most instruments.
Step 4: Watch for Signals
BULL/BEAR CONFLUENCE is the highest-conviction signal — all factors agree. SQZ BREAK signals high-energy breakouts. VWAP RECLAIM/REJECT provides key level context.
Step 5: Use Trend Quality for Filtering
R-squared above 0.6 means the trend is clean and tradeable. Below 0.4 means the trend is choppy — consider waiting for cleaner conditions.
Best Practices
The regime classification is most reliable on timeframes of 5 minutes and above
Session features are most relevant for instruments with clear session structures (equities, futures, major forex)
Squeeze conditions can persist for extended periods. Do not assume a squeeze will break immediately.
Regime transitions (Mixed state) are the most dangerous periods. Consider reducing exposure during transitions.
The institutional score is a heuristic — use it as one input among many, not as a standalone signal
SMA crosses are lagging by nature. They confirm trend changes rather than predict them.
Combine this indicator with structure or momentum tools for entry timing — this indicator provides context, not entries.
Limitations
Regime detection uses lagging indicators (SMAs, BB percentile). Regime changes are confirmed after they occur, not predicted in advance.
The six-regime classification is a simplification. Real markets exist on a continuum, not in discrete states.
Session times are hardcoded for EST timezone sessions. Instruments traded primarily in other timezones may need different session definitions.
R-squared measures linearity, not direction. A perfectly linear downtrend has the same R-squared as a perfectly linear uptrend.
The institutional activity score is estimated from available data (body ratio, volume, BB position). True institutional activity detection requires order flow data not available in Pine Script.
VWAP resets daily on most instruments. Intraday VWAP slope is most meaningful for day trading timeframes.
Kill Zone highlighting assumes EST-based session times. Adjust the timezone input for your local market.
Technical Implementation
Built with Pine Script v6 using:
Three-dimensional regime classification (SMA alignment + VWAP slope + BB volatility)
Regime confidence scoring with per-regime formulas
Session detection using time() with configurable timezone
R-squared trend quality via ta.correlation()
Annualized historical volatility with percentile ranking
Wyckoff effort/result absorption detection
Multi-factor institutional activity scoring
Priority-based signal system with 6 tiers and cooldown anti-overlap
Volatility-adaptive gradient background coloring
Aurora-themed SMA ribbon with alignment-responsive colors
10 alert conditions covering regime changes, SMA crosses, absorption, and clean trend detection
Originality Statement
This indicator is original in its comprehensive regime detection and session awareness integration. While SMA alignment and Bollinger squeeze are established concepts, this indicator is justified because:
The three-dimensional regime classification (SMA + VWAP slope + BB volatility) produces a more robust state detection than any single method
Regime confidence scoring quantifies how clearly the market fits the detected state, providing actionable uncertainty information
Session awareness with quality ratings integrates time-of-day context directly into the regime framework
R-squared trend quality measurement distinguishes between clean tradeable trends and choppy non-directional trends
The priority-based signal system with 6 tiers ensures only the most important events are displayed
Candle heatmap coloring driven by regime and trend quality provides immediate visual context
The Aurora Borealis theme with volatility-adaptive background creates a dynamic visual environment that changes character with market conditions
Squeeze duration tracking and regime duration counting provide temporal context for current conditions
Disclaimer
This indicator is provided for educational and informational purposes only. It is not financial advice or a recommendation to buy or sell any financial instrument. Regime detection classifies current market conditions based on historical data — it does not predict future regime changes. Markets can transition between regimes without warning. Squeeze conditions do not guarantee breakouts. Session quality ratings are generalizations that may not apply to all instruments or market conditions. Past regime patterns do not guarantee future behavior. Always use proper risk management and never risk more than you can afford to lose. The author is not responsible for any losses incurred from using this indicator.
-Made by officialjackofalltrades
Wskaźnik Pine Script®






















