
Hysteresis Bands: An Engineering Weapon Against Market Noise
Hysteresis stops threshold chattering with dual entry/exit bands that kill commission bleed.
Hysteresis stops threshold chattering with dual entry/exit bands that kill commission bleed.
What Is Hysteresis? The Wisdom of the Thermostat
The most familiar real-world application of hysteresis is your home air conditioner, or a thermostat.
Suppose you set the AC to 24°C. If the designer used only a single threshold (compressor on above 24°C, off below 24°C), then the moment room temperature dips to 23.9°C the unit shuts off — but your body heat pushes it back to 24.1°C within seconds, and the unit fires right back up. The compressor would burn itself out from this insanely high-frequency on-off cycling.
Smart engineers don't do that. They set dual thresholds:
- When room temperature rises above 25°C, the AC turns on (Entry).
- The AC only turns off once the temperature drops below 23°C (Exit).
That 2°C gap in the middle is the "hysteresis band." It allows the system to hold its current state within a zone, ignoring tiny data fluctuations and environmental noise.
Applying Hysteresis to Live Quant Trading
In the Macro-Rotational Portfolio, we completely abandoned the single-threshold approach and strictly follow the hysteresis design principle. Entry and exit thresholds are fully decoupled, creating a trading buffer zone.
Take our core signal, the Log-Spread Indicator (10-day percentile rank of the log-spread), as an example:
- Entry threshold: when the rank is > 90, buy with the full position.
- Exit threshold: when the rank falls < 80, close the position and step aside.
The 10 points in between (from 80 to 90) are the fortress wall protecting our portfolio.
# Macro-Rotational Portfolio: hysteresis logic implementation
def execute_hysteresis_logic(self, name, current_signal, current_position):
"""
Handle entries and exits using hysteresis logic
Avoid friction costs from the signal whipsawing around a single threshold
"""
ENTRY_THRESHOLD = 90.0
EXIT_THRESHOLD = 80.0
# If currently flat (no position)
if current_position == 0:
if current_signal > ENTRY_THRESHOLD:
log(f"[{name}] Momentum broke above {ENTRY_THRESHOLD}, firing buy signal.")
return "BUY"
# If currently holding a position (long)
elif current_position > 0:
# The signal must fall through the lower exit threshold to confirm momentum exhaustion
if current_signal < EXIT_THRESHOLD:
log(f"[{name}] Momentum decayed below {EXIT_THRESHOLD}, firing close signal.")
return "SELL"
else:
# Even if the signal falls from 95 to 85, keep holding as long as it stays above 80
return "HOLD"
return "NONE"
How this plays out in live trading: Suppose the market is in a strong semiconductor expansion cycle. The indicator surges to 95 and we go long. Over the next few days, some mild profit taking hits the market and the indicator briefly slips back to 85.
A typical single-threshold system (with 90 as the line) would trigger a sell right there. Our system doesn't.
As long as the signal hasn't decisively broken below the absolute decay line at 80, the system concludes: "This is just a normal momentum pullback within a strong dominant trend — the underlying logic of the trend hasn't changed." So it holds the position with conviction. A few days later, when the shakeout ends and the signal punches back up to 98, we're still on board — riding the entire main leg of the rally.
The Friction Costs That Mercilessly Devour Your Capital
Why does this matter so much for real live trading?
In the frictionless vacuum of a backtest, frequent trading doesn't look like much of a problem — it might even make your equity curve look smoother. But in real capital markets, every trade bleeds. You face brutal frictional costs:
- Bid-ask spread: every round trip costs a few ticks. For some less-liquid sector ETFs (like
COPXorLIT), slippage can be savage. - Commissions: even so-called zero-commission brokers carry implicit platform and regulatory fees. In our system backtests we strictly assume a one-way cost of
0.00005. It adds up — enough to be fatal. - Market impact: as your capital grows, your buy orders push the price up and your sell orders hammer it down. You end up eating your own profits.
The hysteresis design is the strongest shield protecting quant profits from friction costs. It makes the system "sluggish" — but this is an intelligent, deliberate sluggishness. It filters out the market's white noise and ensures the system acts only when an asset's momentum undergoes a genuine, structural reversal.
Epilogue: Learning to Live with Imperfection
Discretionary traders forever chase buying the exact bottom and selling the exact top. Quant traders understand that the pursuit of perfection is the beginning of ruin.
The price of hysteresis is that we must accept entering only after the signal is confirmed (giving up the first stretch of the move), and exiting only after the signal breaks the lower bound (giving back a slice of paper gains). In exchange, we gain powerful immunity to market noise. This dramatically reduces the number of wasted trades and improves the strategy's average trade profit and overall profit factor. This is the unavoidable road from laboratory code to a live Wall Street book.