Structural Deviation Compass [JOAT]Structural Deviation Compass
Introduction
The Structural Deviation Compass is an overlay indicator designed to map where price stands relative to its own statistical history. Rather than drawing fixed-distance envelopes or relying on a single moving average, it constructs a hybrid centerline from two distinct low-lag moving average types, then wraps that centerline in volatility-adaptive bands derived from Z-score normalization. A secondary oscillator layer — applied to RSI — creates a dual-confirmation signal gate that fires only when both price deviation and momentum reach simultaneous extremes. Shadow bands built from the Average True Range provide additional spatial context across three volatility tiers.
The indicator does not predict future price. It identifies statistically unusual deviations from an estimated mean structure and flags conditions where a reversion or continuation setup may be forming, subject to confirmation from the trader's own process.
Core Concepts
The ComboMA Centerline
The foundation of the indicator is a composite moving average called the ComboMA, formed by averaging two lines:
ALMA (Arnaud Legoux Moving Average): Uses a Gaussian-weighted kernel positioned asymmetrically along the lookback window. The offset and sigma parameters control how far toward the recent end the weight mass sits and how tightly it is concentrated. This produces a smooth line that tracks price closely while suppressing noise better than a simple EMA of the same length.
ZLMA (Zero-Lag Moving Average): Constructed by doubling a base EMA and subtracting a second EMA of that EMA — a technique that estimates and removes the inherent lag of an exponential average. The result is then smoothed once more to reduce the noise amplification that zero-lag constructions can introduce.
Averaging the two produces a centerline that carries reduced lag from the ZLMA side while retaining the smooth, noise-filtered character of the ALMA side. Neither line alone fully satisfies both goals; together they produce a more balanced result.
Z-Score Price Bands
Rather than plotting bands at a fixed multiple of a standard deviation (as Bollinger Bands do using a rolling standard deviation of price itself), the SDC first computes the deviation of close from the ComboMA, then Z-score normalizes that deviation series over a separate lookback window. The bands are then placed back on the price chart by multiplying the rolling standard deviation of deviations by the chosen Z-score threshold values.
The practical effect is that the band width reflects how unusual the current deviation is relative to the recent distribution of deviations — not simply how wide price has swung in a raw sense. Two threshold levels are provided, creating an inner and outer band pair on each side of the ComboMA.
RSI Z-Score
RSI is computed in the standard way, then subjected to the same Z-score normalization: the RSI value is compared to its own rolling mean and expressed in standard deviations. This removes the fixed-level bias of RSI (where 30/70 thresholds mean different things in different market regimes) and produces a momentum reading that is self-calibrating to recent RSI behavior.
Dual Z-Score Signal Gate
A long signal requires all of the following simultaneously:
Price Z-score below the negative trigger threshold (price is statistically far below the ComboMA)
RSI Z-score below the negative trigger threshold (momentum is statistically depressed)
RSI EMA below 38 (confirming a bearish momentum context rather than a pullback within strength)
The current bar closed above the prior bar's close (a micro-confirmation that selling pressure may be easing)
The bar is confirmed (signal does not repaint on the forming bar)
Short signals apply the mirror logic. The requirement for extremes in both dimensions simultaneously is intentionally strict — it filters out the many cases where price is extended but momentum is not, or vice versa.
ATR Shadow Bands
Three pairs of shadow bands are drawn around the ComboMA at 1x, 2x, and 3x of a rolling ATR. These are not signal bands — they serve as a spatial reference, helping to contextualize how far price has traveled from the estimated mean in volatility-adjusted terms. A move to the 3x ATR shadow in a low-volatility environment carries different significance than the same move in a high-volatility environment.
RGB Smooth Color Transition
The ComboMA line color transitions smoothly between a bull and bear palette by independently blending the red, green, and blue channels via EMA. Each channel tracks a target value set by the current bull/bear state, and converges toward it gradually. This avoids abrupt color flips and gives a visual sense of momentum continuity.
Gradient Bar Coloring
Individual bars are colored based on where the close sits within the band range relative to the ComboMA. Bars near the upper bands trend toward the bull color; bars near the lower bands trend toward the bear color. Bars near the ComboMA receive a neutral tone. This is a visual aid only and does not constitute a signal.
Information Table
A 9-row table displays the current readings for: market regime, price Z-score, RSI Z-score, RSI EMA, band width, signal strength, active signal, and ComboMA value. This gives a snapshot of the indicator's internal state without requiring the trader to hover over each plotted element.
---
Features
Hybrid ComboMA centerline combining ALMA and ZLMA
Volatility-adaptive Z-score bands at two threshold levels (inner and outer)
RSI Z-score normalization for regime-independent momentum reading
Dual Z-score signal gate requiring simultaneous extremes in price and momentum
Three-layer ATR shadow bands for spatial volatility context
Smooth RGB channel blending on the ComboMA line color
Gradient bar coloring based on position within band range
Real-time information table with 9 indicator state readings
Non-repainting signals (barstate.isconfirmed)
Fully toggleable visual components
---
Input Parameters
MA Length: Base length for the ZLMA and ATR calculations
ALMA Offset: Controls asymmetric weight positioning within the ALMA window (0 = old end, 1 = recent end)
ALMA Sigma: Controls weight concentration; lower values spread the weight, higher values tighten it
Z-Score Lookback: Rolling window for computing the mean and standard deviation of price deviations (default: 50)
Inner Band Threshold: Z-score level for the inner band pair (default: 1.5σ)
Outer Band Threshold: Z-score level for the outer band pair (default: 2.5σ)
RSI Length: Period for RSI calculation (default: 14)
RSI Z-Score Lookback: Rolling window for normalizing RSI
Signal Trigger: Z-score threshold required in both dimensions to generate a signal (default: 1.8σ)
ATR Multipliers: Multipliers for the three shadow band tiers (1x, 2x, 3x)
Visual Toggles: Individual on/off controls for bands, shadows, bar coloring, table, and signals
---
How to Use
Reading the centerline: The ComboMA acts as the estimated mean structure. Price consistently above it with a bull-colored line suggests sustained upward bias; price oscillating around it suggests a ranging environment.
Reading the bands: The inner bands (±1.5σ by default) represent moderately unusual deviations. The outer bands (±2.5σ by default) represent statistically rare deviations. A touch or breach of the outer band does not by itself mean a reversal is due — it means the move is statistically uncommon and warrants attention.
Reading the shadow bands: Use the ATR shadows to understand how far, in volatility-adjusted terms, price has moved from the ComboMA. Price at the 3x shadow while also at the outer Z-score band is a more notable condition than either reading alone.
Acting on signals: The dual Z-score signals flag confluent extremes. They should be used as an alert layer within a broader trading framework — not as standalone entry triggers. Consider the broader trend context, the timeframe, and supporting structure before acting.
Using the table: Monitor the signal strength reading to understand how close the current state is to triggering a signal. This is useful for watching a developing setup in real time.
Timeframe notes: The indicator functions on any timeframe. Higher timeframes produce fewer but more structurally significant signals. Lower timeframes will produce more signals, many of which will be noise. Adjust the Z-score lookback and trigger threshold accordingly.
---
Limitations
This indicator does not predict future price movement. All readings are descriptive of past and current bar data.
The ComboMA, like all moving averages, will lag price during sharp trend changes. The ZLMA component reduces but does not eliminate this lag.
Z-score bands assume that price deviations are approximately normally distributed. In instruments with fat-tailed distributions or during extreme events, the statistical thresholds will underestimate the probability of outlier moves.
Signals are non-repainting on confirmed bars but will update on the forming bar until it closes. Always wait for bar close before acting on a signal.
A signal firing does not mean price will reverse. Trending markets can sustain extreme Z-score readings for extended periods.
The RSI EMA threshold (38 for longs) is a fixed filter that may not suit all instruments or regimes. It should be adjusted or disabled if it is filtering out valid setups in the instrument being traded.
The ATR shadow bands are informational only and carry no predictive weight.
Past signal performance on a given instrument is not indicative of future performance.
---
Originality Statement
The ALMA and ZLMA are established concepts. The ComboMA is not either of them — it is a blended centerline that takes the asymmetric-weight smoothness of ALMA and the lag-reduction property of ZLMA and produces a composite that neither achieves individually. The Z-score normalization of price deviations is a statistical adaptation that makes the bands self-calibrating to the instrument's deviation distribution rather than fixed. Applying the same normalization independently to RSI produces a momentum reading that is self-referential to recent RSI behavior rather than anchored to universal threshold levels. The signal gate that requires simultaneous Z-score extremes in both price deviation and RSI — not one or the other — creates a logical AND condition that is substantially stricter than conventional oscillator crossovers or single-band-touch triggers. The three ATR shadow tiers, smooth RGB color blending, and gradient bar coloring are supporting visual constructs that serve interpretation rather than adding trading logic. The combination of these elements into a single overlay tool — ComboMA centerline, adaptive Z-score bands, normalized momentum gate, ATR spatial context, and state table — represents an original integration not replicated by any standard built-in indicator.
---
Disclaimer
This indicator is provided for educational and informational purposes only. It does not constitute financial advice, investment advice, or a recommendation to buy or sell any financial instrument. Trading involves substantial risk of loss. Past performance of any indicator or strategy is not indicative of future results. Always conduct your own research and consult a qualified financial professional before making any trading decisions.
-Made with passion by officialjackofalltrades
Pine Script® indicator






















