Market Regime Detector
A free TradingView indicator that answers one question before you click buy: what kind of market am I actually in? Adaptive thresholds, four distinct regimes, anti-flicker confirmation, and a built-in anchored VWAP that auto-positions to the start of every new trend.
The problem most regime indicators don't solve
Search "regime" in TradingView's indicator library and you'll find no shortage of options. Most fail in one of two ways. The simple ones hard-code a magic number — "ADX above 25 means trending" — calibrated on one instrument on one timeframe, and they quietly fall apart the moment you load a different symbol, because volatility and trend distributions vary wildly across markets and sessions. The fancy ones bolt on machine learning, then flicker between labels in exactly the transition zones where you most need a steady read.
The genuinely useful question — "is this a clean trend, a volatile trend, a chop-fest, or a dead session?" — almost never gets answered well. And the distinction that matters most to an intraday trader, the difference between a volatile trend (worth pressing) and a volatile range (the account-killer), gets collapsed into one undifferentiated red "avoid" zone. This indicator was built to separate them. More on adapting tactics to market conditions in our day-trading content.
The four regimes, and what each one means for you
Trending & volatile
Direction and range together — the prime momentum environment. Big candles moving the same way. This is the state most detectors can't tell apart from chop, and it's where the best intraday moves live.
Trending & calm
An orderly grind in one direction with muted volatility. The textbook pullback-entry environment — clean structure, predictable retracements, low noise.
Volatile chop
Wide two-sided candles going nowhere. High volatility, no net direction — the account-killer. The indicator flags this so you can stand down or switch to mean-reversion tactics.
Quiet range
Low volatility, no direction — a dead session. Thin conditions where most setups don't pay. Small size or wait for the market to wake up.
What makes it different
Self-calibrating, not hard-coded
Every metric is ranked against its own recent distribution using percentile scoring. A reading is "volatile" because it sits in the top third for this symbol on this timeframe — not because it crossed a number tuned on some other chart. Load it on NQ 1m or BTC 4h and it adapts without retuning.
Four states, not three
Two axes — a trend score (Kaufman Efficiency Ratio plus ATR-normalized EMA slope) and a volatility score (ATR plus Bollinger-width percentiles) — cross into four regimes. Crucially, volatile trend and volatile chop are split apart instead of lumped into one "avoid" blob.
Anti-flicker confirmation
A regime only flips after several consecutive bars agree, so the label stays stable instead of strobing through transition zones. A confidence reading shows how decisively the current state clears its threshold. No repainting on confirmed bars.
Read it in one glance
The chart background shades by regime and a compact corner dashboard shows the live trend score, volatility score, direction, confidence, and a one-line tactical note for the current state. Optional alerts fire on confirmed regime changes.
Built-in anchored VWAP, auto-anchored to trend starts
Most continuation traders eventually discover anchored VWAP — a volume-weighted average drawn from a specific pivot, against which pullbacks become high-probability entries. The hard part isn't the math; it's choosing the right anchor. The 9:30 cash open is too generic. An arbitrary swing low is too subjective. The most useful anchor for catching continuation moves is the bar a trend actually began — and that's exactly what the regime engine already knows.
v1.2 added an optional anchored VWAP that the regime detector positions for you. By default, the script anchors a fresh VWAP every time the regime transitions into a trending state (TREND or TREND+VOL) and tracks the volume-weighted fair value of the trend leg as it develops. Pullbacks back to that line become continuation candidates with both regime context (you're in a trending environment) and price-level context (you're at the trend's fair value) confirming the setup.
Trend start
Anchors when the regime enters TREND or TREND+VOL. Built for catching pullback continuations to a developing trend's fair value.
Regime change
Anchors on every state shift. Gives you a per-regime fair-value reference; more resets, more granular reads.
Session open
Classic session VWAP — anchors at the start of each day. Useful on faster timeframes where regime trends are short.
The line dims automatically outside trending regimes (CHOP and QUIET) — a visual cue that you're not in a continuation environment, so the VWAP is memory rather than a current target. Optional ±1σ standard deviation bands let you spot overextensions from fair value. All toggleable in the indicator settings — disable the whole feature and the regime detector behaves exactly like v1.1.
The settings most users will touch
Defaults are tuned for index futures (NQ, ES) on intraday charts. The percentile lookback is the one core input worth adjusting to your timeframe; the two threshold inputs control how eager the detector is to call "trend" or "volatile."
| Setting | Default | What it does |
|---|---|---|
| Core engine | ||
| Percentile lookback | 120 | Window each metric is ranked against. Drop to ~80–100 on the 1m, bump to ~160 on the 15m. |
| Trend percentile threshold | 60 | Trend score above this percentile counts as trending. Raise toward 65–70 if it calls trends too readily. |
| Volatility percentile threshold | 65 | Volatility score above this percentile counts as volatile. |
| Confirmation bars | 3 | How many agreeing bars before the regime label flips. Higher = steadier, slower. |
| Efficiency Ratio length | 14 | Lookback for the Kaufman ER trend component. |
| ATR / Bollinger length | 14 / 20 | Lookbacks for the two volatility components. |
| Anchored VWAP (v1.2) | ||
| Show anchored VWAP | On | Master on/off toggle for the VWAP overlay. Turn off if you only want the regime detector. |
| Auto-anchor on | Trend start | When to reset the VWAP anchor. Three modes: Trend start (default), Regime change, Session open. |
| Show ±1σ bands | Off | Optional standard deviation envelope. Useful for spotting overextensions from fair value. |
| Dim outside trends | On | Fades the VWAP line during CHOP and QUIET. Visual cue that continuation logic doesn't apply. |
Why no "ADX > 25" box to configure: there isn't one. The whole point of percentile scoring is that you never hand-tune a threshold per symbol. The defaults above are starting points, not magic numbers — the engine recalibrates to whatever chart you load it on.
Suggested starting settings by timeframe
Sensible starting points, not absolute optima. Load the values for your timeframe, watch one or two sessions, and adjust if the regime calls don't match your own read of the tape. The Percentile lookback is the main dial; everything else is either self-calibrating or default-suitable across timeframes.
| Timeframe | Lookback | Confirmation | VWAP anchor |
|---|---|---|---|
| 1-minute | 80 | 2 | Session open |
| 2-minute / 3-minute | 100 | 2–3 | Trend start |
| 5-minute — defaults | 120 | 3 | Trend start |
| 15-minute | 160 | 3 | Trend start |
| 30-minute | 140 | 3 | Trend start |
| 1-hour | 120 | 2 | Trend start |
| 4-hour | 80 | 2 | Session open |
| Daily | 80 | 2–3 | Disable |
How to install
30 seconds, no signup, no email gate.
- Open the script on TradingView and click the star icon to add to favorites.
- Open any chart. Click Indicators in the top toolbar.
- Click Favorites. Click Market Regime Detector to load it.
- Click the gear icon next to the indicator name in the chart to adjust the percentile lookback for your timeframe (see table above).
Ready to try it?
Open source, free forever, no signup. Works on any TradingView chart, any market, any timeframe.
Install on TradingView →Source code visible on the TradingView script page · Pine Script v6 · No repainting
Honest limitations
A few things worth acknowledging up front, because closed-source competitors usually hide their limitations and that practice is worse than disclosing them.
It classifies context, it doesn't generate signals. The detector tells you what kind of market you're in so you can pick the right tactic. It won't tell you where to enter or exit — that's your strategy's job. A favorable regime is a green light to deploy your edge, not the edge itself. The anchored VWAP in v1.2 makes the entry level more concrete (pullbacks to the trend's fair value), but the trigger is still your own price action read. More on matching strategy to conditions in our trading psychology content.
Transitions are inherently fuzzy. The confirmation buffer trades a little lag for a lot of stability — so the label arrives a few bars after a regime genuinely shifts. That's deliberate. If you need the earliest possible flip, lower the confirmation bars, but expect more whipsaw in choppy stretches.
The percentile baseline needs history. The engine ranks each reading against the trailing lookback window, so on a freshly loaded chart with little history the scores can be jumpy until enough bars accumulate to form a stable distribution.
Frequently asked questions
How is this different from an ADX or Choppiness Index regime filter?
Those rely on fixed thresholds — a single number that was calibrated on one market and silently misfires on others. This detector ranks every metric against its own recent distribution, so the boundary between "trending" and "ranging" recalibrates to whatever symbol and timeframe you load it on. It also separates volatile trend from volatile chop, which single-metric filters can't do.
How does the anchored VWAP know where to anchor?
By default it auto-anchors at the bar where the regime transitions into TREND or TREND+VOL. The whole point of the regime engine is identifying when meaningful structural shifts happen — and the start of a new trend leg is the most meaningful pivot for an anchored VWAP. Two other anchor modes are available: "Regime change" anchors on every state shift, and "Session open" anchors at the start of each day for classic session-VWAP behaviour. All configurable from the Anchored VWAP input group.
Does it repaint?
No. All classification logic runs on confirmed bars, and the anti-flicker confirmation buffer only advances the regime once enough completed bars agree. The label you see on a historical bar is the label that was assigned when that bar closed. The anchored VWAP follows the same principle — once an anchor fires on a confirmed regime transition, the line plots forward from that bar and doesn't redraw history.
What timeframe and market should I use it on?
It's tuned out of the box for index futures (NQ, ES, MNQ, MES) on intraday charts, but because the engine is adaptive it works on forex, crypto, and stocks without retuning. See the Suggested starting settings by timeframe table above for lookback values across 1-minute through Daily timeframes.
Will it tell me when to buy or sell?
No, and any indicator that claims to is selling you something. This is a context filter. It tells you whether the current environment favors momentum, pullback entries, mean reversion, or sitting on your hands. The anchored VWAP narrows down where a continuation pullback might pay off, but the trigger is still your own price action read at that level.
Is it really free and open source?
Free, full stop — no paid tier, no upgrade prompts. The full Pine Script v6 source is visible on the TradingView script page, so you can audit exactly how every regime is computed before you trust it on a live chart. Fork it and adapt it to your own strategy if you want; that's the point of open source.
Can I get an alert when the regime changes?
Yes. The indicator includes an alert that fires on a confirmed regime change, with the new regime name and confidence reading in the message. Because it only triggers after the confirmation buffer clears, you won't get spammed by every flicker in a transition zone.










