pub fn detect_regime(
regime_rules: &[RegimeRule],
default_regime: &str,
indicators: &TechnicalIndicators,
current_state: &mut RegimeState,
hysteresis: &HysteresisConfig,
now: u64,
) -> StringExpand description
Detect current market regime based on regime rules, with hysteresis.
Hysteresis logic:
- If current regime held < min_hold_secs -> ignore new regime signals
- If pending_switch exists and target matches -> confirmation_count += 1
- If confirmation_count >= hysteresis.confirmation_count -> switch
- Else record pending_switch, wait for next confirmation