Skip to main content

Market Regime Adaptive Strategy

The regime adaptive feature detects the current market state (trending / ranging / volatile) and automatically adjusts trading parameters — signal thresholds, leverage limits, and position sizes — to match the environment.

Academic Basis

Paper: Springer Digital Finance 2025

Key finding: Regime-aware strategies significantly outperform static parameter strategies across all market conditions.

Three Market Regimes

RegimeDetectionBehavior
TrendingPrice consistently above/below MA, ADX highRelax thresholds, allow higher leverage
RangingPrice oscillating between support/resistance, ADX lowTighten thresholds, reduce leverage
VolatileHigh ATR, large price swings, low trend clarityStrict thresholds, minimum leverage

Parameter Adjustments

When regime detection is active, these parameters are overridden dynamically:

signal_threshold:  0.50   (relaxed — momentum strategies work)
min_confidence: 0.35 (lower bar — trend has conviction)
max_leverage: 10× (leverage benefits from direction)
max_position_pct: 80% (use most of allocated capital)

Ranging Market

signal_threshold:  0.75   (tightened — mean-reversion needs precision)
min_confidence: 0.55 (higher bar — no clear direction)
max_leverage: 5× (limited — range can break any time)
max_position_pct: 40% (conservative sizing)

Volatile Market

signal_threshold:  0.85   (very strict — avoid whipsaws)
min_confidence: 0.65 (high confidence required)
max_leverage: 3× (protect against liquidation on spikes)
max_position_pct: 30% (minimal exposure)

The 11 Market States

The MarketState enum defines 11 granular states that map to the 3 regimes:

MarketStateRegime
STRONG_UPTREND, UPTREND, WEAK_UPTRENDTrending
STRONG_DOWNTREND, DOWNTREND, WEAK_DOWNTRENDTrending
RANGING_HIGH, RANGING_LOW, RANGINGRanging
HIGH_VOLATILITYVolatile
UNCERTAINVolatile

Signal Scorer Regime Adaptation

The SignalScorer (src/data/signal_scorer.py) adjusts factor weights based on regime:

Signal FactorTrending WeightRanging WeightVolatile Weight
Trend (MA alignment)HighLowLow
Momentum (RSI, MACD)MediumLowLow
Mean reversionLowHighLow
VolatilityLowLowLow (raw; dampened)

In trending markets, trend-following signals are amplified. In ranging markets, mean-reversion signals dominate.

Enabling Regime Adaptive

# config.yaml
enhanced_analysis:
enabled: true # required — provides market state data

regime_adaptive:
enabled: true
Dependency

regime_adaptive requires enhanced_analysis.enabled: true to function. The enhanced analysis pipeline computes the market state from enriched data.

Custom Parameter Overrides

You can override the default regime parameters:

regime_adaptive:
enabled: true
trending:
signal_threshold: 0.45 # even more relaxed
min_confidence: 0.30
max_leverage: 12
ranging:
signal_threshold: 0.80
max_leverage: 4
volatile:
signal_threshold: 0.90
max_leverage: 2

Regime Hint in Prompt

The current regime is injected into the LLM prompt as {{ regime_hint }}:

Current market regime: RANGING
Parameters active: signal_threshold=0.75, max_leverage=5x
Recommended bias: Mean-reversion favored. Avoid breakout trades.
Wait for clear support/resistance rejection before entry.

This gives the LLM explicit context about why certain parameters are tighter, improving reasoning quality.

Interaction with Other Features

FeatureInteraction
FinCoTRegime hint aids Step 1 (Trend Confirmation) and Step 6 (Final Decision)
DebateRegime context is available to both BullAgent and BearAgent
Review SystemRegime-aware memory tags lessons with source_regime for future filtering
Signal ScorerFactor weights dynamically adjusted per regime

Monitoring Regime Changes

Regime transitions are logged:

[INFO] Regime changed: RANGING → TRENDING for BTC
[INFO] Applying trending parameters: threshold=0.50, leverage_max=10

Watch for frequent regime flipping — if you see many transitions in short periods, consider widening the ADX threshold in src/data/market_state.py.

Next Steps