Get started

Adding Hysteresis So the Regime Flag Stops Flickering Weekly

A dual-threshold band plus a dwell clock over the raw regime scores removes most of the switch chatter. The break-even inequality between turnover saved and lateness paid is four terms long.

Adding Hysteresis So the Regime Flag Stops Flickering Weekly

A regime overlay that changes its mind every few weeks is not an overlay, it is a transaction cost generator with a research paper attached. The failure is rarely in the classifier. It is in the decision rule bolted on top of it, which is almost always the argmax of a set of scores, evaluated fresh at every update with no memory of what it said last time.

The fix is old and it is boring. Two thresholds instead of one, and a clock. What is worth doing carefully is the parameterisation, because the band and the dwell are not free and the arithmetic that decides whether they pay is short enough to write down.

Where the flicker actually comes from

The Market Regime Detector publishes raw scores alongside its classification. At the capture I am working from, the visible bars read Expansion 75, Alt Season 55 and Liq Rally 45, and the card carried a Risk-On Expansion label at 75 percent confidence.

A twenty point gap between the top two scores is a comfortable margin. The problem is not the state the screen is in, it is the states it passes through. If two scores converge to within a few points, the argmax becomes a function of noise, and a rule that reads the argmax will switch on the noise, switch back, and switch again. Every one of those switches carries a full portfolio reweight if the regime drives allocation.

There is a second and less obvious source. The engine fuses three scorecards, so the scores inherit the update cadences of all three. A component that refreshes on a different schedule from the others will drag the fused score across a boundary and back purely as an artifact of arrival timing, with no change in the underlying environment at all.

Before building anything, check whether the module's own timeframe control already solves your problem. The screen offers 1D, 1W and 1M toggles, and reading the slower one is a form of smoothing that costs nothing to implement. Measure the switch rate on each toggle over your own snapshot history first. If the 1M reading gives you an acceptable switch count, a hysteresis layer is redundant complexity and you should not ship it.

Market Regime Detector showing regime probability score bars with Expansion at 75, Alt Season at 55 and Liq Rally at 45, above 1D 1W and 1M timeframe toggles
The score bars are the raw material a hysteresis layer sits on, not the regime name above them. Expansion at 75 against Alt Season at 55 is a wide margin, and the whole design problem is what your rule does in the weeks when that gap is two points instead of twenty.

Two thresholds and a dwell clock

The layer has three parameters and they do different jobs.

The entry threshold H is the score a regime must reach before you will adopt it. The exit threshold L, strictly below H, is the score the currently held regime must fall beneath before you will abandon it. Between L and H, you hold whatever you were already holding. That band is the whole of the hysteresis, and it kills every oscillation whose amplitude is smaller than the band width.

The dwell parameter k is a minimum holding period on the flag itself. Once you switch, no further switch is permitted for k periods regardless of what the scores do. This is a different mechanism from the band and it catches a different failure, namely a score that makes one large decisive-looking excursion and immediately reverses.

Compose them in the order that keeps the rule auditable. Evaluate the band first, then require the band condition to hold for k consecutive updates before the flag actually moves. Do not evaluate the dwell clock against the raw argmax, because that lets a single noisy print start a countdown you then have to explain in a review.

One asymmetry is worth building in deliberately. Make the band and the dwell narrower for moves toward lower risk than for moves toward higher risk. Being slow to de-risk and quick to re-risk is the wrong error to make with someone else's capital, and a symmetric rule quietly commits you to it.

Setting the band from the score's own noise, not from taste

The band width should come from the vintage-to-vintage volatility of the scores themselves, which means you need a snapshot archive before you can set it. Store each update with its timestamp, the timeframe you read, and every score, and after a few months compute the standard deviation of the period-over-period change in each score.

A band of roughly two of those standard deviations is the usual starting point, because it makes a boundary crossing driven purely by update noise an uncommon event rather than a routine one. Narrower and you are not doing much. Wider and you are approaching a rule that never switches, which is a legitimate choice but should be made explicitly rather than by parameter drift.

Set k from persistence rather than from noise. Estimate how long the underlying environment typically stays put, and set the dwell to a small fraction of that. A dwell approaching the typical regime length converts the overlay into a constant, and you will only discover that after the fact when you notice the flag has not moved in a year.

The four-term inequality that decides whether it pays

Hysteresis buys you removed switches and it costs you lateness on the switches that were real. Both sides are computable with your own numbers, and I would rather write the inequality than quote figures I have not measured.

The savings side is three terms. Take the number of switches per year your current argmax rule produces, subtract the number the hysteresis rule would have produced on the same history, multiply by the fraction of gross that turns over on a regime change, and multiply by your round-trip cost in basis points on that turnover. That product is the annual saving in basis points of the portfolio.

The cost side is four terms. Take the number of genuine regime turns per year, meaning the ones both rules eventually agree on. Multiply by the average delay the hysteresis adds to each, which is the dwell k plus the expected time for the score to travel from L to H. Multiply by the change in exposure between the two regimes. Multiply by the average adverse drift per period during a genuine turn. That product is the annual cost.

The shape of the answer is what matters. Because the savings term scales with the number of spurious switches and the cost term scales with the number of genuine ones, hysteresis pays handsomely on a noisy flag and barely at all on a clean one. Run the inequality on the daily, weekly and monthly readings separately. The daily reading will almost certainly show the largest saving, and it will also show the largest number of switches to begin with, which is a hint that the correct answer for most books is to stop reading the daily flag rather than to smooth it.

The failure mode to instrument before you ship

The characteristic disaster of a hysteresis layer is a slow, monotone deterioration. Every individual update is a small move, none of them alone triggers the exit threshold, the dwell clock keeps resetting the argument for patience, and the flag holds a risk-on regime through most of a drawdown. The rule performs exactly as designed and the outcome is indefensible.

Guard it with a bypass that does not use the flag. A hard de-risking trigger tied to a realised portfolio or market risk measure, with authority to cut exposure irrespective of what the regime layer says, and a written rule about who can invoke it. The regime overlay decides the tilt. It does not get to decide whether you are allowed to reduce risk.

Instrument two diagnostics from day one. Track the time each flag spends inside the band, which tells you whether the band is doing work or is simply never binding. And track every occasion the hysteresis rule and the raw argmax disagreed, with the eventual outcome of each, because that log is the only honest evidence about whether the layer helped, and it is the document you will want in front of you the first time the flag is late.

WRITTEN BY
Blockcircle Team

Financial market intelligence covering crypto, stocks, commodities, precious metals, and prediction markets.