Files
siloqy/docs/planning/siloqy-hausdorff-implementation-analysis.md

12 KiB
Raw Permalink Blame History

SILOQY Hausdorff Implementation Analysis

Clarification: Universal Threshold Issue

Problem Identified

The research document contained a critical contradiction:

  1. Claimed: "universal fractal dimension threshold of 1.25 as an early warning system for market corrections"
  2. Regime classification data showed:
    • Trending markets: Fractal dimension 1.0-1.3
    • Random walk regimes: Fractal dimension ≈1.5
    • Range-bound markets: Fractal dimension 1.7-2.0
    • Volatile/crisis regimes: Fractal dimension > 1.8

The Contradiction

Based on the regime classification ranges, a fractal dimension of 1.25 would indicate a TRENDING market (within the 1.0-1.3 range), NOT a market correction warning. This directly contradicts the claim about it being an "early warning system for market corrections."

Resolution

The document needs significant revision. For SILOQY implementation, focus on the regime classification ranges rather than the unsupported "1.25 universal threshold" claim.

Trading Regime Analysis: Pros/Cons for Predictive Maximization

Pros:

  • Most predictable direction - established momentum
  • Lower noise-to-signal ratio - fractal dimension closer to 1.0 = smoother price action
  • Trend-following strategies excel - clear directional bias
  • Risk management easier - stops can be placed against trend direction
  • Consistent profit potential - can ride trends for extended periods

Cons:

  • Late entry risk - trends may be mature when detected
  • Whipsaw risk during transitions - false breakouts at trend exhaustion
  • Lower volatility = smaller absolute gains per time unit

Trading Approach: Trend-following, momentum strategies, breakout systems

RANDOM WALK REGIMES (FD ≈1.5) - AVOID COMPLETELY

Pros:

  • None for directional trading

Cons:

  • Zero predictability - truly random price movements
  • High transaction costs - frequent false signals
  • No exploitable patterns - efficient market conditions
  • Stop-loss hunting - random moves trigger stops frequently

Trading Approach: STAND ASIDE - preserve capital, wait for regime change

RANGE-BOUND MARKETS (FD 1.7-2.0) - MODERATE TO HIGH OPPORTUNITY

Pros:

  • Mean reversion predictability - prices tend to return to range center
  • Clear support/resistance levels - defined risk parameters
  • High win rate potential - if range holds, reversals are likely
  • Options strategies favorable - time decay benefits sellers
  • Statistical certainty - prices WILL return toward range center (mathematically inevitable)
  • Clear trigger points - when price hits support/resistance, reversal probability is high
  • Defined probability zones - the further from center, the higher probability of reversal

Cons:

  • Breakout risk - ranges eventually break, causing losses
  • Lower profit per trade - limited by range width
  • Requires precise timing - entry/exit points critical
  • Choppy price action - multiple false signals within range

Trading Approach: Mean reversion, range trading, short straddles/strangles

VOLATILE/CRISIS REGIMES (FD > 1.8) - HIGH RISK/REWARD

Pros:

  • Massive profit potential - large price moves create big opportunities
  • Strong momentum persistence - once direction established, moves are powerful
  • Volatility premium expansion - options become more valuable
  • Fast profits - significant moves happen quickly

Cons:

  • Extreme unpredictability - direction changes rapidly and violently
  • High drawdown risk - wrong positions can be devastating
  • Emotional stress - difficult to maintain discipline
  • Liquidity issues - spreads widen, slippage increases
  • System failures - extreme moves can break algorithmic assumptions

Trading Approach: Volatility trading, crisis alpha strategies, very tight risk management

Revised Predictability Rankings

RANKING FOR PREDICTIVE MAXIMIZATION:

1. TRENDING MARKETS (FD 1.0-1.3) - BEST CHOICE

  • Predictability: 8/10
  • Profitability: 7/10
  • Risk-Adjusted Returns: 9/10
  • Consistency: 9/10

2. RANGE-BOUND MARKETS (FD 1.7-2.0) - HIGH OPPORTUNITY (Revised upward)

  • Predictability: 8/10 (Corrected from 6/10)
  • Profitability: 6/10
  • Risk-Adjusted Returns: 7/10 (Revised upward)
  • Consistency: 7/10

3. VOLATILE/CRISIS REGIMES (FD > 1.8) - SPECIALISTS ONLY

  • Predictability: 3/10
  • Profitability: 9/10
  • Risk-Adjusted Returns: 4/10
  • Consistency: 2/10

4. RANDOM WALK (FD ≈1.5) - AVOID

  • Predictability: 0/10
  • Profitability: 0/10
  • Risk-Adjusted Returns: 0/10
  • Consistency: 0/10

Key Insight on Range-Bound Markets

Range-bound markets offer different but equally valuable predictability:

  • Trending markets: Predict direction continuation
  • Range-bound markets: Predict direction reversal

Both are highly exploitable, just requiring different strategies.

Hausdorff Implementation Strategy for SILOQY

Integration Architecture Overview

Within DOLPHIN Framework: DOLPHIN currently analyzes 500 symbols using 15m candles for correlation-based regime detection. Hausdorff dimension would add a fractal layer to this analysis.

Dual-Layer Implementation:

  1. Market-wide fractal regime (like current DOLPHIN correlation analysis)
  2. Target asset fractal state (BTC-specific for hand-tuned parameters)

Time Frame Strategy - Multi-Scale Approach

Primary Timeframe: 15m (matches existing DOLPHIN)

  • Window size: 50-100 candles (12.5-25 hours of data)
  • Update frequency: Every new 15m candle close
  • Purpose: Main regime classification for JERICHO state machine

Secondary Timeframes for Confirmation:

  • 5m candles: 150-300 points (12.5-25 hours) - faster regime change detection
  • 1h candles: 25-50 points (1-2 days) - longer-term regime confirmation
  • Daily candles: 20-30 points (20-30 days) - structural regime context

Multi-Scale Coherence Check: Cross-timeframe validation where all scales must agree for high-confidence regime classification:

IF (FD_5m ∈ trending AND FD_15m ∈ trending AND FD_1h ∈ trending) 
THEN high_confidence_trending = TRUE

Data Requirements

For Market-Wide Analysis (500 symbols):

  • OHLCV data for fractal dimension calculation
  • Rolling window: 100 x 15m candles per symbol
  • Memory footprint: ~50MB (much smaller than current correlation matrices)
  • Update frequency: Every 15m candle close

For Target Asset (BTC) Enhanced Analysis:

  • Tick-by-tick data (from Nautilus integration)
  • Multiple timeframes simultaneously
  • Real-time Bollinger Band distances (already planned for JERICHO)
  • Volume profile data for fractal dimension confirmation

Implementation Layers

Layer 1: Fast Fractal Screening (Higuchi Method)

  • Purpose: Real-time regime filtering across all 500 symbols
  • Calculation: O(N×k_max) complexity - very fast
  • Output: Basic regime classification (trending/ranging/crisis/random)
  • Integration point: Feeds into existing DOLPHIN correlation analysis

Layer 2: Precision Fractal Analysis (Correlation Dimension)

  • Purpose: High-accuracy analysis for target asset (BTC)
  • Calculation: More computationally intensive but higher precision
  • Output: Precise fractal dimension values for JERICHO thresholds
  • Integration point: Direct input to JERICHO state machine

Layer 3: Multi-Scale Validation

  • Purpose: Cross-timeframe regime confirmation
  • Calculation: Lightweight comparison across timeframes
  • Output: Confidence scores for regime classifications
  • Integration point: Enhances JERICHO decision confidence

Data Flow Integration

Current DOLPHIN Flow:

Symbol Discovery → Price Data Fetch → Correlation Analysis → Regime Detection

Enhanced DOLPHIN Flow:

Symbol Discovery → Price Data Fetch → 
├── Correlation Analysis (existing)
├── Fast Fractal Screening (Layer 1) 
└── Combined Regime Classification

Target Asset Enhancement:

BTC Price Stream → 
├── Multi-timeframe Fractal Analysis (Layer 2)
├── Bollinger Band Distance Calculation
└── JERICHO State Machine Input

JERICHO State Machine Integration Points

Regime Detection Enhancement:

  • Current: DOLPHIN correlation percentages (bull/bear ratios)
  • Enhanced: DOLPHIN + fractal regime classification + confidence scores

Threshold Modifications:

# Current JERICHO logic
if bull_pct >= 98.5% and consecutive_scans >= 2:
    signal = LONG

# Enhanced logic  
if (bull_pct >= 98.5% and consecutive_scans >= 2 and 
    fractal_regime == TRENDING and fractal_confidence > 0.8):
    signal = LONG

New State Additions:

  • FRACTAL_WATCHING: When fractal dimension approaches regime boundaries
  • MULTI_SCALE_CONFLICT: When timeframes disagree on regime
  • FRACTAL_CONFIRMATION: When fractal analysis confirms correlation-based signals

Computational Considerations

Processing Pipeline:

  1. Streaming updates: As new 15m candles arrive
  2. Incremental calculation: Update fractal dimensions using sliding windows
  3. Parallel processing: 500 symbols can be processed simultaneously
  4. Caching strategy: Store intermediate results for efficiency

Performance Targets:

  • Layer 1 (500 symbols): <5 seconds per 15m update
  • Layer 2 (BTC focus): <1 second per update
  • Layer 3 (validation): <0.5 seconds per update
  • Total overhead: <6.5 seconds (fits within 15m window)

Configuration Strategy

Adaptive Parameters:

  • Window sizes adjust based on volatility (existing hand-tuned parameters)
  • Threshold values adapt to different market conditions
  • Confidence weights for combining correlation + fractal signals

Asset-Specific Tuning:

  • BTC parameters: Use existing hand-tuned volatility thresholds
  • Market-wide parameters: Generic settings for broad regime detection
  • Dynamic adjustment: Learn optimal parameters over time

Risk Management Integration

Regime Transition Detection:

  • Early warning: Fractal dimension approaching transition zones
  • Confirmation: Both correlation and fractal methods agree on regime change
  • Confidence scoring: Strength of regime classification

Fallback Mechanisms:

  • Data quality issues: Fall back to correlation-only analysis
  • Computational overload: Use Layer 1 (fast) method only
  • Regime uncertainty: Increase JERICHO conservatism

Output Integration

For JERICHO State Machine:

{
  "fractal_regime": "TRENDING",
  "fractal_dimension": 1.15,
  "regime_confidence": 0.87,
  "multi_scale_agreement": true,
  "time_to_transition": "2-3 periods",
  "enhanced_signal": "LONG_CONFIRMED"
}

For TUI Display:

FRACTAL: TRENDING (FD:1.15, Conf:87%)
SCALES: 5m✓ 15m✓ 1h✓ | Transition: 2-3 periods

Summary

This approach enhances rather than replaces the existing proven DOLPHIN-JERICHO system, adding fractal analysis as a confirming layer while maintaining the core correlation-based regime detection that has been hand-tuned for Bitcoin. The implementation focuses on:

  1. Multi-scale validation across timeframes
  2. Layered approach from fast screening to precision analysis
  3. Integration points that enhance rather than disrupt existing logic
  4. Performance targets that fit within existing computational constraints
  5. Risk management with fallback mechanisms for reliability