Guide · Systematic trading
What is a regime filter?
The short answer
A regime filter is a rule that decides when a trading system is allowed to trade at all. It classifies the market state along two axes, direction (trending up, down, or sideways) and volatility (quiet, normal, or stressed), and switches the system on only in the states where its edge has a reason to exist. Setups pick trades. The regime filter grants, or withholds, permission to look for them.
Ask why a system died and the autopsy rarely says the edge was imaginary. It usually says the market changed and the system kept trading. A breakout method built in a trending year meets a sideways year and pays for every false break. A mean-reversion method built in a quiet range meets a real trend and fades it all the way down. The rules did not change; the state they depended on did. A regime filter is the component that admits this out loud: it encodes the conditions under which the edge has a reason to exist, and it holds the system flat everywhere else. This guide covers what most explanations skip: the mechanics of the standard filters, what India VIX actually is, the whipsaw arithmetic a gate buys you out of, the honest costs of filtering, and the test that separates a genuine regime filter from one more curve-fit parameter.
Strategies do not fail randomly. They fail out-of-regime.
Every edge is a conditional statement, even when nobody writes the condition down. Trend following says: if the market moves directionally and keeps moving, entering on strength and holding gets paid. Mean reversion says: if price stretches away from a stable centre and returns, fading the stretch gets paid. Long-biased setups of every kind say: if the tape is not gapping lower in a stressed decline, the long side is playable. Generic articles quote the second half of each sentence and forget the first. The first half is the regime.
The failure modes are specific, not vague. Put a trend system in a sideways market and it whipsaws: the rule buys strength near the top of the range, and a range, by definition, sells strength back. Each false break costs roughly one planned risk unit plus costs, and a wide range can manufacture false breaks for months. Put a mean-reversion system in a real trend and it gets run over: it fades a move that does not come back, and because its logic waits for a reversion that never arrives, the one large loss can undo the many small wins that preceded it. Put a long-biased system in a stressed bear phase and it drowns: correlations across stocks rise together, moves arrive as gaps rather than smooth movement, and a position sized for quiet conditions suddenly carries several times the intended risk.
India has run this experiment at full scale. The Nifty 50 fell roughly 60 percent from its January 2008 peak near 6,357 to its October 2008 closing low near 2,524, and it did not sustainably reclaim that peak until late 2013. A long-biased system with no concept of state had no mechanism to stop trading through that. And here the crudest filter earns its keep by arithmetic rather than foresight: price cannot spend a fall of that depth and duration above its own 200-day average, so a plain index-above-200-DMA gate classified most of that decline as a no-long-trades state. The filter predicted nothing. It noticed, mechanically and a little late, and a mechanical noticing was enough to hold a rule-following system out of the worst of it.
So the practical definition of regime uses two axes. Direction: trending up, trending down, or sideways. Volatility: quiet, normal, or stressed. The axes are independent, which is the point most one-line definitions miss: a market can trend calmly, chop violently, or grind lower in eerie quiet, and each combination treats a given system differently. Two axes with three states each give a nine-cell grid, and a system's real performance profile is a statement about cells, not about the market in general.
The standard constructions, and what each one trades away
Direction is usually read from a long moving average. Price above the 200-day simple moving average is the oldest gate in systematic trading because it is one comparison on public data, hard to fudge and trivial to reproduce. Its cost is behaviour at the boundary: when price hugs the average, the gate flips state on almost every close, which is the whipsaw problem imported into the filter itself. The standard patch is a second vote from the average's own slope, for example requiring the 200-day average to be higher than it was a month ago, which screens out the sideways drift where price oscillates across a flat line. Both votes lag by construction: an average of 200 closes cannot turn until enough new closes drag it, so the gate concedes the first part of every new trend and the first part of every top.
Trend strength is read from ADX, J. Welles Wilder's 1978 construction, which smooths the balance of upward and downward directional movement into a reading between 0 and 100. Textbook convention treats readings above 25 as a trending state and below 20 as weak or absent trend. ADX is deliberately blind to direction, which makes it a clean chop detector, and it is doubly smoothed, which makes it late: it confirms a trend after the trend has been underway, and confirms chop after the whipsaws have started.
Volatility is read against the instrument's own history, because absolute thresholds do not transfer between instruments. ATR percentile ranks today's 14-day average true range against its own trailing distribution, one or two years of it, so a 90th-percentile reading means the same thing on an index and on a mid-cap stock. Realised volatility versus its own history applies the same idea to close-to-close moves. Participation is read from breadth: the percentage of index constituents above their own 200-day averages, computable on the Nifty 500 from exchange data. Breadth catches the specific condition index price hides, a narrow rally in which the index makes highs on a handful of heavyweights while the median stock is already below its own average.
Every construction in the table shares one property: it is a lagging summary of data that has already printed. A regime filter does not predict the state. It recognises the state after it has begun, and the design question is never which filter is right, but which lag you can afford to carry.
| Filter | Axis it reads | Construction | The trade-off |
|---|---|---|---|
| 200-DMA position | Direction | Index close above or below its 200-day simple moving average | One reproducible comparison; flips state daily when price hugs the line |
| Moving-average slope | Direction persistence | The 200-day average higher than it was roughly a month ago | Screens out flat-line drift; turns even later than the price cross |
| ADX band | Trend strength | Wilder's ADX(14); above 25 read as trending, below 20 as weak | Direction-blind chop detector; double smoothing confirms late |
| ATR percentile | Volatility, realised | Today's ATR(14) ranked against its own one-to-two-year distribution | Comparable across instruments; reacts only after volatility has moved |
| Realised vol vs history | Volatility, realised | 20-day close-to-close volatility against its trailing distribution | Same lag; a volatility spike is in the market before it is in the filter |
| Breadth | Participation | Percent of Nifty 500 members above their own 200-day averages | Sees narrow rallies the index hides; needs constituent data upkeep |
| India VIX band | Volatility, expected | Level or percentile of the option-implied 30-day volatility index | Forward-looking but index-level only; fixed cutoffs decay, percentiles travel |
India VIX: what the number actually is
Most articles call India VIX the fear gauge and stop there, which leaves you unable to reason about it. The construction is precise. India VIX is NSE's volatility index, launched in April 2008, computed from the best bid and ask quotes of out-of-the-money near-month and mid-month Nifty 50 option contracts. The methodology is adopted from CBOE's variance-based approach, with amendments to fit the Nifty option order book, including cubic-spline interpolation to fill strikes where usable quotes are missing. The output is a single annualised percentage: the expected volatility of the Nifty 50 over the next 30 calendar days, as implied by what option buyers and writers are actually quoting.
Two details in that construction matter for filtering, and most explanations omit both. First, it is built from live order-book quotes, not from a survey or a sentiment model: when India VIX rises, someone is paying more for optionality right now. Second, it is a licensed adaptation rather than a home-grown formula: VIX is a trademark of CBOE, and Standard and Poor's granted NSE a licence, with CBOE's permission, to use the mark. The practical consequence of the construction is that India VIX is the one common volatility measure that looks forward. ATR and realised volatility describe what price has already done; India VIX prices what the option market expects over the next month. A serious volatility filter often pairs one of each, backward-looking and forward-looking, precisely because they disagree at turning points.
The honest way to band it is against its own history, not against folklore numbers. The verified extremes frame the range: the November 2008 crisis and the March 2020 crash both pushed India VIX above 80, and its record calm has taken it below 10. Between those extremes NSE publishes a level, not an interpretation, and any fixed cutoff you adopt is a parameter you must justify. Percentile bands computed against a trailing window travel better across years than fixed numbers, for the same reason ATR percentile beats raw ATR. And one structural limit: India VIX is an index-level measure. A single stock's volatility state can sit far from it, which is why stock-level systems still need ATR or realised-volatility conditions underneath an index-level VIX gate.
Two layers: the market gate and the setup filter
A regime filter is not one more condition bolted onto the entry rule. Architecturally it sits a layer above. The market-level gate is computed once a day on the index or the tradable universe and answers a single question: is the system allowed to operate today? The setup-level conditions are computed per instrument, per signal, and answer a different question: does this particular trade qualify? Keeping the layers separate is what makes each testable, because every blocked trade then has exactly one attributable reason: the gate said no, or the setup failed.
As pseudo-rules, a long breakout system gated by direction and volatility looks like this:
allow_longs = (nifty500_close > sma(nifty500_close, 200))
and (atr_percentile(index, lookback_2y) < 80)
# layer 2, the setup filter: checked per stock, only while the gate is open
signal = (close > highest(high, 20)) and (volume > sma(volume, 20))
# when the gate is closed, no signals are read at all
if not allow_longs: stay_flat()
The 80th-percentile cutoff is written as a number because a system must be written in numbers, not because 80 is truth. It is a parameter, chosen before testing and defended with evidence, and the testing section below is about exactly that defence. The deeper design point is the shape of the flow: the no-trade branch is a first-class output. When the gate is closed the system is flat on purpose, holding its capital and its statistics intact, and a flat month in a hostile state is the system working, not the system failing.
Whipsaw anatomy: what the gate is buying
Make the failure concrete with rupee arithmetic. A stock has spent four months oscillating between roughly ₹470 and ₹520. A breakout system's rule is mechanical: buy the close above ₹520, stop below the breakout structure at ₹505, so the planned risk is ₹15 per share. A trader risking ₹3,000 per trade sizes 200 shares. The range then does what ranges do: it produces closes marginally above ₹520 that attract the entry and fail. Each attempt fills near ₹521 and stops near ₹504 with slippage, call it ₹16 to ₹17 per share, roughly ₹3,300 per attempt. Four false breaks over the four months cost about ₹13,000 before brokerage and taxes, on a stock that finished the period almost exactly where it started. Nothing malfunctioned. The rule did what it was written to do; the state made the rule wrong.
A direction or trend-strength gate, an ADX floor or a flat-200-DMA lockout, classifies those months as rangebound and holds the system flat through all four attempts. The honest half of the ledger is that the same gate is late to the real move: when the genuine breakout finally comes, the filter confirms only after part of the move has happened, so the gated system enters above the ungated one. That is the actual exchange on offer, many small false starts traded for one late true start, and whether the exchange suits a given system is not a matter of taste. It is a measurable property, which is what the testing section below is for.
The three costs, priced honestly
The first cost is lag at both ends, and it cannot be engineered away, only chosen. A filter built from lagging summaries exits after part of the damage and re-enters after part of the recovery. The 2013 side of the 2008 episode is the sobering half: an index gate that held a system out of the long decline also held it out of the early recovery, until price climbed back through the average and the gate reopened. A filter never sells tops or buys bottoms. Its entire value is skipping the middle of hostile states, and the middle is all it can skip.
The second cost is statistical and almost never stated. Filters delete trades, and sample size is the currency of confidence. Gate a system that produced 200 historical trades down to 80 and the standard error of every per-trade estimate grows by a factor of about 1.6, because confidence scales with the square root of the count. The filtered backtest can be cleaner and less trustworthy at the same time: fewer trades means wider uncertainty around whatever the trades appear to show, and fewer trades also makes every remaining parameter easier to fit to noise.
The third cost is the filter itself as a degree of freedom. Which measure, which lookback, which threshold: that is three parameters before the entry rule has any. Tune them until the historical equity curve looks best and you have not discovered a regime, you have memorised the specific sequence of past regimes, which is curve-fitting wearing a risk-management costume. The full discipline that keeps this honest, in-sample and out-of-sample splits, walk-forward testing and the ways a backtest invalidates itself, is covered in our guide to backtesting integrity.
How to test a filter: buckets, not aggregates
The common test is the wrong one: run the backtest with the filter and without it, and keep the filter if the aggregate improves. Any condition that happens to delete some losing trades improves an aggregate; that is subtraction, not detection. A regime filter is a claim about cause: the edge exists in some states and not in others. The test must interrogate the claim, and the way to do that is to tag every historical signal with the regime that prevailed when it fired, then read the buckets separately.
A real regime filter produces separation you can point at. The allowed bucket contains the bulk of whatever edge the backtest measured. The blocked bucket, the trades the system would have taken while the gate was shut, is where the damage concentrates. The boundary zone, signals that fired within a small distance of the filter line, is where the churn lives, and it should shrink when you add a buffer or a confirmation delay. If the aggregate improved but the buckets look alike, the filter is decoration fitted to one history.
| Bucket | Which trades | What to compute | What must be true if the filter is real |
|---|---|---|---|
| Allowed | Signals that fired while the gate was open | Trade count, average result per unit risked, worst losing run | The bulk of the measured edge concentrates here |
| Blocked | Signals the system would have taken while the gate was shut | The same metrics, simulated as if taken | The damage concentrates here; if this bucket resembles the allowed one, the filter is decoration |
| Boundary | Signals within a small distance of the filter line | Flip count of the gate, cost of each round trip | Most churn lives here, and it shrinks with a buffer or a confirmation delay |
| Aggregate | All signals together | The headline backtest | Never judged alone; an aggregate lift without bucket separation is curve-fitting |
Two further checks close the case. Perturb the threshold: if the conclusion holds at a 200-day average but dies at 190 or 210, you tested luck, not state. And demand a mechanism you can say out loud: breakouts need directional persistence and broad participation, so a trend-and-breadth gate has a reason to matter; a filter you cannot explain is a pattern you happened to find. On stacking, start with one filter per axis, a direction measure and a volatility measure joined by AND. Every additional condition multiplies parameters, shrinks the allowed sample and adds a new way to curve-fit, and a five-condition gate that makes the backtest immaculate is indistinguishable from deleting losers by hand.
The survival organ
A regime filter adds no edge. It protects one, which is a different job and a more important one. The difference between a strategy and a system is exactly this component: a strategy knows what to do, a system also knows when doing it is allowed. Position sizing decides how much a single trade can hurt you; the regime filter decides whether the trade exists at all. That is why it is the survival organ of a systematic method: it keeps the strategy alive through the states that kill its premise, so that there is still capital, and still a valid sample, when its state returns. Choosing the axes, defending the thresholds and proving the buckets separate is unglamorous, mechanical work, and that upstream work is exactly what the method we teach is built around.
Common Questions
Frequently Asked Questions
What is a regime filter in trading?
+A regime filter is a rule that decides when a trading system is allowed to trade at all. It classifies the market state, usually along two axes, direction (trending up, down, or sideways) and volatility (quiet, normal, or stressed), and switches the system on only in states where the edge has a reason to exist. It sits above the setup: setups pick trades, the regime filter grants or withholds permission to look for them. When the filter says no, the system is flat by design.
Why do trading strategies stop working?
+Less often randomly, more often out-of-regime. Every edge is conditional on a market state: trend-following needs directional persistence, so it bleeds through whipsaws in a sideways range; mean reversion needs a stable range, so it gets run over when a real trend starts; long-biased setups need a market that is not gapping lower in a stressed decline. When the state changes, the premise behind the edge is absent, and the system keeps executing a bet whose condition no longer holds. A regime filter exists to detect that and stand the system down.
What are the main market regimes?
+The practical grid has two axes. Direction: trending up, trending down, or sideways. Volatility: quiet, normal, or stressed. They are independent: a market can trend quietly, chop violently, or fall in a low-volatility grind. Each cell of the grid favours different behaviour: trend systems want directional persistence, mean reversion wants a contained range, and almost nothing long-biased works well in the trending-down, stressed-volatility cell. Naming the current cell mechanically is the whole job of a regime filter.
What are the most common regime filters?
+Direction is usually read from a long moving average: price above or below the 200-day average, sometimes with the average's own slope as a second condition. Trend strength is read from ADX. Volatility state is read from ATR or realised volatility ranked against its own history, or from India VIX for index-level work. Participation is read from breadth, for example the percentage of Nifty 500 constituents above their own 200-day averages. Every one of them is a lagging summary of recent data; the choice is about which lag you can live with.
What is India VIX?
+India VIX is NSE's volatility index. It is computed from the best bid and ask quotes of out-of-the-money near-month and mid-month Nifty 50 option contracts, using a methodology adopted from CBOE with amendments for the Nifty order book, and it expresses the market's expectation of annualised volatility over the next 30 calendar days. It was launched in April 2008. Unlike ATR or realised volatility, which describe what price has already done, India VIX is forward-looking: it reads what option prices currently imply, which is why volatility filters often pair one backward-looking and one forward-looking measure.
Do regime filters reduce returns?
+They reduce trades, which is not the same thing. A filter's direct effect is to cut exposure: the system sits out every period the filter classifies as hostile, including some that turn out fine, and it re-enters late after every turn because filters lag. What it buys in exchange is that the system stops executing in states where its premise is absent. Whether that trade-off is worth it for a given system depends on whether the edge is genuinely regime-conditional, which is exactly what regime-bucketed testing is designed to establish before you trust the filter.
How do I test a regime filter?
+Split the backtest by regime bucket, not by comparing two aggregate numbers with and without the filter. Tag every historical signal with the regime that prevailed when it fired, then compare the buckets: the trades the filter would allow against the trades it would block. A real filter shows separation, the damage concentrates in the blocked bucket, and the conclusion survives out-of-sample data and small changes to the threshold. An aggregate improvement with no bucket separation means the filter is fitting noise, not detecting a state.
Can a regime filter be overfitted?
+Easily, and it is the most seductive form of curve-fitting because it sounds like risk management. A filter adds parameters: which measure, which lookback, which threshold. Tune those until the backtest looks best and you have fitted the filter to the specific sequence of past regimes, not to a repeatable state. The defences are the same as for any parameter: fewer of them, thresholds justified before testing, results that hold across nearby settings, and out-of-sample confirmation. A filter that only helps at exactly one setting is an accident.
Should I use one regime filter or many?
+Start with one per axis: one direction measure and one volatility measure, combined with AND logic. Two conditions already produce a usable grid, and every additional condition multiplies the parameter count, shrinks the sample of allowed trades, and adds another way to curve-fit. Stacking five filters until the backtest is clean is indistinguishable from deleting the losing trades by hand. Add a third condition only when regime-bucketed evidence shows the first two systematically misclassify a state that matters, such as narrow rallies that breadth catches and price does not.
Where the facts come from
Sources
- NSE India VIX white paper and computation methodology. Establishes the construction: best bid and ask quotes of out-of-the-money near and mid-month Nifty 50 option contracts, a methodology adopted from CBOE with amendments including cubic-spline interpolation, an output of expected 30-calendar-day annualised volatility, the April 2008 launch, and the VIX trademark licence granted to NSE via Standard and Poor's with CBOE's permission. nseindia.com (white paper, PDF)
- NSE historical index and India VIX data. Establishes the January 2008 Nifty 50 peak near 6,357, the October 2008 closing low near 2,524, the roughly 60 percent drawdown that was not sustainably reclaimed until late 2013, and the India VIX extremes: above 80 in November 2008 and March 2020, below 10 at its record calm. nseindia.com (historical data)
- J. Welles Wilder, New Concepts in Technical Trading Systems (1978). Establishes the ADX and ATR constructions used in trend-strength and volatility filters, and the origin of the textbook reading conventions for trending versus weak-trend states.
- NSE Indices factsheets. Establish the Nifty 500 constituent universe on which the breadth measure, the percentage of members above their own 200-day averages, is computed from exchange data.