Cycles Detector

Advanced Market Cycle Detection and Analysis System

Analysis Configuration

×

📊 Complete Cycles Detector System Documentation

🔬 How Cycle Detection Works

1. Morlet Wavelet Transform (CWT)

What it does: Decomposes price data into frequency components to find dominant cycles.

Algorithm:

For each wavelength (100-800 days):
  1. Create Morlet wavelet with Q=50 (high selectivity)
  2. Convolve wavelet with price data at multiple time windows
  3. Calculate RMS power = sqrt(mean(|convolution|²))
  4. Average power across sliding windows

Key Parameters:

2. Power Spectrum & Amplitude

What "Amplitude" means:

The amplitude in the power spectrum is NOT price amplitude. It is the RMS (Root Mean Square) power of the wavelet transform coefficients - a measure of cycle strength, not price movement size.


⚙️ Letter Rating System (A/B/C/D)

What it measures: Statistical quality of the cycle signal

The 5 Metrics:

1. Amplitude Stationarity (0-100%)
How consistent the wave height is over time

amplitudes = [abs(peak - trough) for each cycle]
CV = std(amplitudes) / mean(amplitudes)
stationarity = exp(-2 × CV) × 100%

2. Frequency Stationarity (0-100%)
How consistent the wavelength is over time

wavelengths = [distance between zero-crossings]
CV = std(wavelengths) / mean(wavelengths)
error = abs(mean_wl - expected_wl) / expected_wl
stationarity = exp(-2 × CV - error) × 100%

3. Spectral Isolation (0-100%)
How well-separated this cycle is from other cycles

wl_separation = abs(wl - nearest_wl) / wl
power_ratio = peak_power / nearest_peak_power
isolation = (wl_separation × 0.5 + tanh(power_ratio-1) × 0.5) × 100%

4. Signal-to-Noise Ratio (SNR)
How much stronger the cycle is vs background noise

signal = spectrum[peak_wavelength]
noise = mean(spectrum[far_from_peak])
SNR = signal / noise

5. Gain Rank
Where this cycle ranks in power/strength

Rating Classification:

Rating Criteria Use
🔥 A Amp/Freq > 80%, Rank 1, Isolation > 70%, SNR > 5.0 HIGHEST - Primary signals
👌 B Amp/Freq > 70%, Rank ≤ 2, Isolation > 60%, SNR > 3.0 HIGH - Reliable trading
👍 C Amp/Freq > 60%, Rank ≤ 2, SNR > 2.0 MODERATE - Confirmation
⚠️ D Below C thresholds LOW - Avoid trading

💰 Component Yield Calculation

What it is: Theoretical trading performance if you perfectly traded the cycle's peaks and troughs.

Note: This is a theoretical trading simulation for comparing cycle quality.

Algorithm:

1. Find peaks (sell signals) and troughs (buy signals) in bandpass
2. Create chronological event list
3. Execute trades (long-only):
   - Buy at each trough
   - Sell at next peak
   - Calculate return = (sell - buy) / buy × 100%
4. Sum all trade returns = cumulative yield

Example:

Buy at trough:  $100 → Sell at peak: $110 → 10% return
Buy at trough:  $108 → Sell at peak: $130 → 20.4% return
Cumulative Yield: 10% + 20.4% = 30.4%

Interpretation:

⚠️ This is theoretical "perfect" trading (hindsight)
⚠️ Does NOT account for: slippage, commissions, realistic entry/exit timing
⚠️ Purpose: Compare cycle quality, not predict actual returns


⭐ Star Rating System (V12 - Harmonic Validation)

What it measures: Physical validity based on Hurst's harmonic theory

Harmonic Theory (J.M. Hurst):

Real market cycles are harmonically related by simple ratios: 2:1, 3:1, 4:1

Example Family:
720d (base)
 ├─ 360d (half - 2:1 ratio)
 ├─ 240d (third - 3:1 ratio)
 └─ 180d (quarter - 4:1 ratio)
     └─ 90d (half of 180d)

Quality Score (0-100):

50 points from SNR:

50 points from Harmonic Family:

Stars Score Label
⭐⭐⭐⭐ 80-100 Excellent - Large family, high SNR
⭐⭐⭐ 60-79 Good - Part of family, good SNR
⭐⭐ 40-59 Fair - Small family or marginal SNR
0-39 Poor - Orphan or low SNR

Orphan Cycles:

Definition: Cycles with no harmonic partners
Why they matter: Likely noise or measurement artifacts, not real market rhythms
Display: Shown in red to warn users


💊 Health Metrics (V12 - Cycle Degradation Detection)

What it measures: Whether a cycle is weakening or changing period over time

Two Key Indicators:

1. Amplitude Consistency
Is the cycle losing power?

Compare recent 3 cycles vs historical average:
amp_change_pct = (recent_avg - historical_avg) / historical_avg × 100%

2. Wavelength Stability
Is the cycle speeding up or slowing down?

Measure actual period via peak-to-peak distance:
drift_pct = (measured_period - expected_period) / expected_period × 100%

Health Score (0-100):

Badge Score Status Action
🟢 80-100 Healthy ✅ Safe to trade - cycle stable
🟡 60-79 Degrading ⚠️ Monitor closely - showing weakness
🔴 0-59 Unstable ❌ Avoid - cycle breaking down

Trading Tip: Even an A-rated cycle with 4 stars should be avoided if Health shows 🔴 Unstable. Health metrics detect when previously-strong cycles are losing reliability.


🎯 Combined Trading Strategy

Letter Stars Confidence Trading Action
A ⭐⭐⭐⭐ HIGHEST 🏆 Gold standard - best possible signal
A/B ⭐⭐⭐⭐ or ⭐⭐⭐ HIGH ✅ Use for PRIMARY trading signals
B/C ⭐⭐⭐ MODERATE ⚡ Use for SECONDARY signals or confirmation
D Any LOW ❌ Don't trade - too unreliable
Any LOW ❌ Don't trade - orphan/noise

📈 Complete Workflow

1. DETECTION (Morlet CWT)
   ↓
   Power Spectrum → Find peaks (dominant cycles)

2. EXTRACTION (Bandpass Filter)
   ↓
   Isolate each cycle → Create pure sine-like wave

3. QUALITY ANALYSIS
   ↓
   Calculate 5 metrics → Assign A/B/C/D rating

4. YIELD SIMULATION
   ↓
   Trade peaks/troughs → Calculate theoretical return

5. HARMONIC VALIDATION (V12)
   ↓
   Find families → Assign ⭐ rating

6. TRADING DECISION
   ↓
   Combine letter + stars → Choose best signals

💡 Pro Tips

🏆 Best Practice: Focus on cycles with high letter ratings (A/B) AND high star ratings (⭐⭐⭐⭐/⭐⭐⭐). These represent cycles that are both statistically clean AND physically valid according to harmonic theory.