Volatility Regime Switch [Metrify]VRS is a regime classifier that tries to separate two things most indicators mix together: direction and tradability. It doesn’t just ask "is price above/below a line?". it estimates whether the market is currently behaving more like a trend regime or a noise/chop regime, then adapts its switching logic and trailing structure accordingly. The output is a state machine (bull/bear) with a volatility-normalized corridor, plus explicit markers for switch accepted vs switch rejected.
Core idea: switching should depend on regime
Most trend flip tools fail in choppy markets because they apply the same confirmation rules everywhere. VRS tries to avoid that by measuring a continuous regime score:
trreg ≈ how “trend-like” conditions are
nsreg ≈ how “noise-like” conditions are
That regime estimate is then used to:
shape the trailing band distance (wider in chop, tighter in trend),
change the required confirmation for a switch (more strict in noise), and
demand follow-through after a candidate switch (acceptance check).
Regime estimation: how it decides “trend-like” vs “noise-like”
The regime score is built from three normalized features, then blended using inverse-variance weighting again:
Efficiency ratio (ER): Measures directional efficiency: net displacement over a horizon vs total movement. Trends have higher efficiency; chop has lower.
ADX-like trend strength: A custom ADX calculation is normalized (adxn), giving a bounded “trend strength” component.
Volatility ratio (fast/slow): Compares fast ATR to slow ATR and normalizes it. This helps distinguish active expansion vs quieter conditions.
These three components are combined into trreg (0..1). Noise regime is nsreg = 1 - trreg.
The important part is it can behave differently when the market is structurally trending versus when it is structurally noisy.
The anchor + adaptive bands: how the corridor is built
VRS uses two EMAs:
a fast EMA (emaf)
a slower EMA (emas)
It then creates an anchor that interpolates between them based on regime:
when trend regime is strong (trreg high), the anchor leans toward the fast EMA (more responsive)
when noise regime is strong (nsreg high), it leans toward the slow EMA (more stable)
Band distance is bdist = volc * bmult, and bmult is also regime-dependent:
in noise, bmult becomes larger → bands widen → fewer false flips
in trend, bmult tightens → better trailing sensitivity
Finally, the trailing bands (fup, flo) use a classic "non-decreasing band" logic similar to trailing-stop structures: the band only moves in the favorable direction unless price invalidates it, preventing constant band oscillation.
Bias and conviction layer
A switch is not triggered merely by close above/below a band. VRS computes conviction, which mixes:
Intra-bar price action bias
Two normalized elements are used: CLV (close location value) inside the candle range and body direction/strength relative to candle range. Both are Z-scored and squashed (atan-based) to avoid extreme outliers dominating.
Trend bias
Difference between fast and slow EMA, normalized by volatility, then Z-scored and squashed.
Displacement breakout quality
If price breaks above fup or below flo, it computes a breakout 'distance' normalized by volatility, then converts it into a Z-score relative to recent breakout behavior (dbullz, dbearz)
These get blended into a conviction signal that is smoothed, and then compared against a dynamic trigger threshold built from the average + stdev of conviction magnitude. A flip should happen when price action + trend bias + breakout quality jointly exceed what is normal for this market recently.
Practical reading notes
VRS generally behaves best when read as "current regime context + boundary + switch events" rather than as a constant entry/exit engine. In trending conditions, the trail will tend to hug price more tightly and switches will be less frequent. In noisy conditions, the corridor widens and the script becomes more conservative, often producing rejected switch attempts rather than rapid flips.
The rejected-switch markers (yellow X) are explicit evidence that the script detected an attempted regime change but did not see enough acceptance. For discretionary use, those rejection points can be useful as information about failed break attempts or lack of follow-through.
This script is designed to be adaptive, but it still has structural constraints. It uses volatility normalization and regime weighting to reduce parameter brittleness, yet extreme regime changes (sudden volatility spikes, news-driven moves, illiquid gaps) can still cause behavior that looks late or 'overly strict', because acceptance and confirmation are intentionally conservative in high-noise conditions. Conversely, on very smooth trend legs, the trail can appear tight and switches may look clean, but that depends on how the chosen lengths match the instrument’s tempo.
Also, because this is a state machine with acceptance logic, you should expect situations where price briefly breaks a boundary and then returns—those are exactly the environments that produce rejected switches. The indicator surfaces that behavior explicitly instead of hiding it.
Pine Script® Indikator






















