OPEN-SOURCE SCRIPT
Cập nhật

Dimensional Resonance Protocol

170
Dimensional Resonance Protocol [DRP]

🌀 CORE INNOVATION: PHASE SPACE RECONSTRUCTION & EMERGENCE DETECTION

The Dimensional Resonance Protocol represents a paradigm shift from traditional technical analysis to complexity science. Rather than measuring price levels or indicator crossovers, DRP reconstructs the hidden attractor governing market dynamics using Takens' embedding theorem, then detects emergence—the rare moments when multiple dimensions of market behavior spontaneously synchronize into coherent, predictable states.

The Complexity Hypothesis:
Markets are not simple oscillators or random walks—they are complex adaptive systems existing in high-dimensional phase space. Traditional indicators see only shadows (one-dimensional projections) of this higher-dimensional reality. DRP reconstructs the full phase space using time-delay embedding, revealing the true structure of market dynamics.

Takens' Embedding Theorem (1981):
A profound mathematical result from dynamical systems theory: Given a time series from a complex system, we can reconstruct its full phase space by creating delayed copies of the observation.

Mathematical Foundation:
From single observable x(t), create embedding vectors:

X(t) = [x(t), x(t-τ), x(t-2τ), ..., x(t-(d-1)τ)]

Where:
d = Embedding dimension (default 5)
τ = Time delay (default 3 bars)
x(t) = Price or return at time t

Key Insight: If d ≥ 2D+1 (where D is the true attractor dimension), this embedding is topologically equivalent to the actual system dynamics. We've reconstructed the hidden attractor from a single price series.

Why This Matters:
Markets appear random in one dimension (price chart). But in reconstructed phase space, structure emerges—attractors, limit cycles, strange attractors. When we identify these structures, we can detect:
Stable regions: Predictable behavior (trade opportunities)
Chaotic regions: Unpredictable behavior (avoid trading)
Critical transitions: Phase changes between regimes

Phase Space Magnitude Calculation:

phase_magnitude = sqrt(Σ[x(t - i·τ)]² for i = 0 to d-1)

This measures the "energy" or "momentum" of the market trajectory through phase space. High magnitude = strong directional move. Low magnitude = consolidation.


📊 RECURRENCE QUANTIFICATION ANALYSIS (RQA)

Once phase space is reconstructed, we analyze its recurrence structure—when does the system return near previous states?

Recurrence Plot Foundation:
A recurrence occurs when two phase space points are closer than threshold ε:

R(i,j) = 1 if ||X(i) - X(j)|| < ε, else 0

This creates a binary matrix showing when the system revisits similar states.

Key RQA Metrics:

1. Recurrence Rate (RR):
RR = (Number of recurrent points) / (Total possible pairs)
• RR near 0: System never repeats (highly stochastic)
• RR = 0.1-0.3: Moderate recurrence (tradeable patterns)
• RR > 0.5: System stuck in attractor (ranging market)
• RR near 1: System frozen (no dynamics)

Interpretation: Moderate recurrence is optimal—patterns exist but market isn't stuck.

2. Determinism (DET):
Measures what fraction of recurrences form diagonal structures in the recurrence plot. Diagonals indicate deterministic evolution (trajectory follows predictable paths).

DET = (Recurrence points on diagonals) / (Total recurrence points)

• DET < 0.3: Random dynamics
• DET = 0.3-0.7: Moderate determinism (patterns with noise)
• DET > 0.7: Strong determinism (technical patterns reliable)

Trading Implication: Signals are prioritized when DET > 0.3 (deterministic state) and RR is moderate (not stuck).

Threshold Selection (ε):
Default ε = 0.10 × std_dev means two states are "recurrent" if within 10% of a standard deviation. This is tight enough to require genuine similarity but loose enough to find patterns.


🔬 PERMUTATION ENTROPY: COMPLEXITY MEASUREMENT

Permutation entropy measures the complexity of a time series by analyzing the distribution of ordinal patterns.

Algorithm (Bandt & Pompe, 2002):
1. Take overlapping windows of length n (default n=4)
2. For each window, record the rank order pattern
Example: [2.1, 3.5, 1.8, 4.2] → pattern [1,3,0,2] (ranks from lowest to highest)
3. Count frequency of each possible pattern
4. Calculate Shannon entropy of pattern distribution

Mathematical Formula:

H_perm = -Σ p(π) · ln(p(π))

Where π ranges over all n! possible permutations, p(π) is the probability of pattern π.
Normalized to [0,1]:

H_norm = H_perm / ln(n!)

Interpretation:
H < 0.3: Very ordered, crystalline structure (strong trending)
H = 0.3-0.5: Ordered regime (tradeable with patterns)
H = 0.5-0.7: Moderate complexity (mixed conditions)
H = 0.7-0.85: Complex dynamics (challenging to trade)
H > 0.85: Maximum entropy (nearly random, avoid)

Entropy Regime Classification:

DRP classifies markets into five entropy regimes:
CRYSTALLINE (H < 0.3): Maximum order, persistent trends
ORDERED (H < 0.5): Clear patterns, momentum strategies work
MODERATE (H < 0.7): Mixed dynamics, adaptive required
COMPLEX (H < 0.85): High entropy, mean reversion better
CHAOTIC (H ≥ 0.85): Near-random, minimize trading

Why Permutation Entropy?

Unlike traditional entropy methods requiring binning continuous data (losing information), permutation entropy:
• Works directly on time series
• Robust to monotonic transformations
• Computationally efficient
• Captures temporal structure, not just distribution
• Immune to outliers (uses ranks, not values)

⚡ LYAPUNOV EXPONENT: CHAOS vs STABILITY

The Lyapunov exponent λ measures sensitivity to initial conditions—the hallmark of chaos.

Physical Meaning:
Two trajectories starting infinitely close will diverge at exponential rate e^(λt):

Distance(t) ≈ Distance(0) × e^(λt)

Interpretation:
λ > 0: Positive Lyapunov exponent = CHAOS
- Small errors grow exponentially
- Long-term prediction impossible
- System is sensitive, unpredictable
- AVOID TRADING

λ ≈ 0: Near-zero = CRITICAL STATE
- Edge of chaos
- Transition zone between order and disorder
- Moderate predictability
- PROCEED WITH CAUTION

λ < 0: Negative Lyapunov exponent = STABLE
- Small errors decay
- Trajectories converge
- System is predictable
- OPTIMAL FOR TRADING

Estimation Method:
DRP estimates λ by tracking how quickly nearby states diverge over a rolling window (default 20 bars):

For each bar i in window:
δ₀ = |x[i+1] - x| (initial separation)
δ₁ = |x - x[i-1]| (previous separation)

if δ₁ > 0:
ratio = δ₀ / δ₁
log_ratios += ln(ratio)

λ ≈ average(log_ratios)

Stability Classification:

STABLE: λ < 0 (negative growth rate)
CRITICAL: |λ| < 0.1 (near neutral)
CHAOTIC: λ > 0.2 (strong positive growth)

Signal Filtering:
By default, NEXUS requires λ < 0 (stable regime) for signal confirmation. This filters out trades during chaotic periods when technical patterns break down.

📐 HIGUCHI FRACTAL DIMENSION

Fractal dimension measures self-similarity and complexity of the price trajectory.

Theoretical Background:
A curve's fractal dimension D ranges from 1 (smooth line) to 2 (space-filling curve):

D ≈ 1.0: Smooth, persistent trending
D ≈ 1.5: Random walk (Brownian motion)
D ≈ 2.0: Highly irregular, space-filling

Higuchi Method (1988):
For a time series of length N, construct k different curves by taking every k-th point:

L(k) = (1/k) × Σ|x[m+ik] - x[m+(i-1)k]| × (N-1)/(⌊(N-m)/k⌋ × k)

For different values of k (1 to k_max), calculate L(k). The fractal dimension is the slope of log(L(k)) vs log(1/k):

D = slope of log(L) vs log(1/k)

Market Interpretation:
D < 1.35: Strong trending, persistent (Hurst > 0.5)
- TRENDING regime
- Momentum strategies favored
- Breakouts likely to continue

D = 1.35-1.45: Moderate persistence
- PERSISTENT regime
- Trend-following with caution
- Patterns have meaning

D = 1.45-1.55: Random walk territory
- RANDOM regime
- Efficiency hypothesis holds
- Technical analysis least reliable

D = 1.55-1.65: Anti-persistent (mean-reverting)
- ANTI-PERSISTENT regime
- Oscillator strategies work
- Overbought/oversold meaningful

D > 1.65: Highly complex, choppy
- COMPLEX regime
- Avoid directional bets
- Wait for regime change

Signal Filtering:
Resonance signals (secondary signal type) require D < 1.5, indicating trending or persistent dynamics where momentum has meaning.

🔗 TRANSFER ENTROPY: CAUSAL INFORMATION FLOW

Transfer entropy measures directed causal influence between time series—not just correlation, but actual information transfer.

Schreiber's Definition (2000):
Transfer entropy from X to Y measures how much knowing X's past reduces uncertainty about Y's future:

TE(X→Y) = H(Y_future | Y_past) - H(Y_future | Y_past, X_past)

Where H is Shannon entropy.

Key Properties:
1. Directional: TE(X→Y) ≠ TE(Y→X) in general
2. Non-linear: Detects complex causal relationships
3. Model-free: No assumptions about functional form
4. Lag-independent: Captures delayed causal effects

Three Causal Flows Measured:

1. Volume → Price (TE_V→P):
Measures how much volume patterns predict price changes.

TE > 0: Volume provides predictive information about price
- Institutional participation driving moves
- Volume confirms direction
- High reliability

TE ≈ 0: No causal flow (weak volume/price relationship)
- Volume uninformative
- Caution on signals

TE < 0 (rare): Suggests price leading volume
- Potentially manipulated or thin market

2. Volatility → Momentum (TE_σ→M):
Does volatility expansion predict momentum changes?

Positive TE: Volatility precedes momentum shifts
- Breakout dynamics
- Regime transitions

3. Structure → Price (TE_S→P):
Do support/resistance patterns causally influence price?

Positive TE: Structural levels have causal impact
- Technical levels matter
- Market respects structure

Net Causal Flow:
Net_Flow = TE_V→P + 0.5·TE_σ→M + TE_S→P

Net > +0.1: Bullish causal structure
Net < -0.1: Bearish causal structure
|Net| < 0.1: Neutral/unclear causation

Causal Gate:
For signal confirmation, NEXUS requires:
Buy signals: TE_V→P > 0 AND Net_Flow > 0.05
Sell signals: TE_V→P > 0 AND Net_Flow < -0.05

This ensures volume is actually driving price (causal support exists), not just correlated noise.

Implementation Note:

Computing true transfer entropy requires discretizing continuous data into bins (default 6 bins) and estimating joint probability distributions. NEXUS uses a hybrid approach combining TE theory with autocorrelation structure and lagged cross-correlation to approximate information transfer in computationally efficient manner.

🌊 HILBERT PHASE COHERENCE

Phase coherence measures synchronization across market dimensions using Hilbert transform analysis.

Hilbert Transform Theory:
For a signal x(t), the Hilbert transform H[x](t) creates an analytic signal:
z(t) = x(t) + i·H[x](t) = A(t)·e^(iφ(t))

Where:
A(t) = Instantaneous amplitude
φ(t) = Instantaneous phase

Instantaneous Phase:
φ(t) = arctan(H[x](t) / x(t))

The phase represents where the signal is in its natural cycle—analogous to position on a unit circle.

Four Dimensions Analyzed:
1. Momentum Phase: Phase of price rate-of-change
2. Volume Phase: Phase of volume intensity
3. Volatility Phase: Phase of ATR cycles
4. Structure Phase: Phase of position within range

Phase Locking Value (PLV):
For two signals with phases φ₁(t) and φ₂(t), PLV measures phase synchronization:
PLV = |⟨e^(i(φ₁(t) - φ₂(t)))⟩|
Where ⟨·⟩ is time average over window.

Interpretation:
PLV = 0: Completely random phase relationship (no synchronization)
PLV = 0.5: Moderate phase locking
PLV = 1: Perfect synchronization (phases locked)

Pairwise PLV Calculations:
PLV_momentum-volume: Are momentum and volume cycles synchronized?
PLV_momentum-structure: Are momentum cycles aligned with structure?
PLV_volume-structure: Are volume and structural patterns in phase?

Overall Phase Coherence:
Coherence = (PLV_mom-vol + PLV_mom-struct + PLV_vol-struct) / 3

Signal Confirmation:
Emergence signals require coherence ≥ threshold (default 0.70):
• Below 0.70: Dimensions not synchronized, no coherent market state
• Above 0.70: Dimensions in phase, coherent behavior emerging

Coherence Direction:

The summed phase angles indicate whether synchronized dimensions point bullish or bearish:

Direction = sin(φ_momentum) + 0.5·sin(φ_volume) + 0.5·sin(φ_structure)
Direction > 0: Phases pointing upward (bullish synchronization)
Direction < 0: Phases pointing downward (bearish synchronization)

🌀 EMERGENCE SCORE: MULTI-DIMENSIONAL ALIGNMENT

The emergence score aggregates all complexity metrics into a single 0-1 value representing market coherence.

Eight Components with Weights:

1. Phase Coherence (20%):
Direct contribution: coherence × 0.20
Measures dimensional synchronization.

2. Entropy Regime (15%):
Contribution: (0.6 - H_perm) / 0.6 × 0.15 if H < 0.6, else 0
Rewards low entropy (ordered, predictable states).

3. Lyapunov Stability (12%):
• λ < 0 (stable): +0.12
• |λ| < 0.1 (critical): +0.08
• λ > 0.2 (chaotic): +0.0
Requires stable, predictable dynamics.

4. Fractal Dimension Trending (12%):
Contribution: (1.45 - D) / 0.45 × 0.12 if D < 1.45, else 0
Rewards trending fractal structure (D < 1.45).

5. Dimensional Resonance (12%):
Contribution: |dimensional_resonance| × 0.12
Measures alignment across momentum, volume, structure, volatility dimensions.

6. Causal Flow Strength (9%):
Contribution: |net_causal_flow| × 0.09
Rewards strong causal relationships.

7. Phase Space Embedding (10%):
Contribution: min(|phase_magnitude_norm|, 3.0) / 3.0 × 0.10 if |magnitude| > 1.0
Rewards strong trajectory in reconstructed phase space.

8. Recurrence Quality (10%):
Contribution: determinism × 0.10 if DET > 0.3 AND 0.1 < RR < 0.8
Rewards deterministic patterns with moderate recurrence.

Total Emergence Score:
E = Σ(components) ∈ [0, 1]
Capped at 1.0 maximum.

Emergence Direction:
Separate calculation determining bullish vs bearish:

• Dimensional resonance sign
• Net causal flow sign
• Phase magnitude correlation with momentum

Signal Threshold:

Default emergence_threshold = 0.75 means 75% of maximum possible emergence score required to trigger signals.

Why Emergence Matters:

Traditional indicators measure single dimensions. Emergence detects self-organization—when multiple independent dimensions spontaneously align. This is the market equivalent of a phase transition in physics, where microscopic chaos gives way to macroscopic order.

These are the highest-probability trade opportunities because the entire system is resonating in the same direction.

🎯 SIGNAL GENERATION: EMERGENCE vs RESONANCE

DRP generates two tiers of signals with different requirements:

TIER 1: EMERGENCE SIGNALS (Primary)

Requirements:
1. Emergence score ≥ threshold (default 0.75)
2. Phase coherence ≥ threshold (default 0.70)
3. Emergence direction > 0.2 (bullish) or < -0.2 (bearish)
4. Causal gate passed (if enabled): TE_V→P > 0 and net_flow confirms direction
5. Stability zone (if enabled): λ < 0 or |λ| < 0.1
6. Price confirmation: Close > open (bulls) or close < open (bears)
7. Cooldown satisfied: bars_since_signal ≥ cooldown_period

EMERGENCE BUY:
• All above conditions met with bullish direction
• Market has achieved coherent bullish state
• Multiple dimensions synchronized upward

EMERGENCE SELL:
• All above conditions met with bearish direction
• Market has achieved coherent bearish state
• Multiple dimensions synchronized downward

Premium Emergence:

When signal_quality (emergence_score × phase_coherence) > 0.7:
• Displayed as ★ star symbol
• Highest conviction trades
• Maximum dimensional alignment

Standard Emergence:

When signal_quality 0.5-0.7:
• Displayed as ◆ diamond symbol
• Strong signals but not perfect alignment

TIER 2: RESONANCE SIGNALS (Secondary)

Requirements:
1. Dimensional resonance > +0.6 (bullish) or < -0.6 (bearish)
2. Fractal dimension < 1.5 (trending/persistent regime)
3. Price confirmation matches direction
4. NOT in chaotic regime (λ < 0.2)
5. Cooldown satisfied
6. NO emergence signal firing (resonance is fallback)

RESONANCE BUY:
• Dimensional alignment without full emergence
• Trending fractal structure
• Moderate conviction

RESONANCE SELL:
• Dimensional alignment without full emergence
• Bearish resonance with trending structure
• Moderate conviction

Displayed as small ▲/▼ triangles with transparency.

Signal Hierarchy:
IF emergence conditions met:
Fire EMERGENCE signal (★ or ◆)
ELSE IF resonance conditions met:
Fire RESONANCE signal (▲ or ▼)
ELSE:
No signal

Cooldown System:

After any signal fires, cooldown_period (default 5 bars) must elapse before next signal. This prevents signal clustering during persistent conditions.

Cooldown tracks using bar_index:
bars_since_signal = current_bar_index - last_signal_bar_index
cooldown_ok = bars_since_signal >= cooldown_period

🎨 VISUAL SYSTEM: MULTI-LAYER COMPLEXITY

DRP provides rich visual feedback across four distinct layers:

LAYER 1: COHERENCE FIELD (Background)

Colored background intensity based on phase coherence:

No background: Coherence < 0.5 (incoherent state)
Faint glow: Coherence 0.5-0.7 (building coherence)
Stronger glow: Coherence > 0.7 (coherent state)

Color:
• Cyan/teal: Bullish coherence (direction > 0)
• Red/magenta: Bearish coherence (direction < 0)
• Blue: Neutral coherence (direction ≈ 0)

Transparency: 98 minus (coherence_intensity × 10), so higher coherence = more visible.

LAYER 2: STABILITY/CHAOS ZONES

Background color indicating Lyapunov regime:

Green tint (95% transparent): λ < 0, STABLE zone
- Safe to trade
- Patterns meaningful

Gold tint (90% transparent): |λ| < 0.1, CRITICAL zone
- Edge of chaos
- Moderate risk

Red tint (85% transparent): λ > 0.2, CHAOTIC zone
- Avoid trading
- Unpredictable behavior

LAYER 3: DIMENSIONAL RIBBONS

Three EMAs representing dimensional structure:

Fast ribbon: EMA(8) in cyan/teal (fast dynamics)
Medium ribbon: EMA(21) in blue (intermediate)
Slow ribbon: EMA(55) in red/magenta (slow dynamics)

Provides visual reference for multi-scale structure without cluttering with raw phase space data.

LAYER 4: CAUSAL FLOW LINE

A thicker line plotted at EMA(13) colored by net causal flow:

Cyan/teal: Net_flow > +0.1 (bullish causation)
Red/magenta: Net_flow < -0.1 (bearish causation)
Gray: |Net_flow| < 0.1 (neutral causation)

Shows real-time direction of information flow.

EMERGENCE FLASH:

Strong background flash when emergence signals fire:
• Cyan flash for emergence buy
• Red flash for emergence sell
• 80% transparency for visibility without obscuring price

📊 COMPREHENSIVE DASHBOARD

Real-time monitoring of all complexity metrics:

HEADER:
• 🌀 DRP branding with gold accent

CORE METRICS:

EMERGENCE:
• Progress bar (█ filled, ░ empty) showing 0-100%
• Percentage value
• Direction arrow (↗ bull, ↘ bear, → neutral)
• Color-coded: Green/gold if active, gray if low

COHERENCE:
• Progress bar showing phase locking value
• Percentage value
• Checkmark ✓ if ≥ threshold, circle ○ if below
• Color-coded: Cyan if coherent, gray if not

COMPLEXITY SECTION:

ENTROPY:
• Regime name (CRYSTALLINE/ORDERED/MODERATE/COMPLEX/CHAOTIC)
• Numerical value (0.00-1.00)
• Color: Green (ordered), gold (moderate), red (chaotic)

LYAPUNOV:
• State (STABLE/CRITICAL/CHAOTIC)
• Numerical value (typically -0.5 to +0.5)
• Status indicator: ● stable, ◐ critical, ○ chaotic
• Color-coded by state

FRACTAL:
• Regime (TRENDING/PERSISTENT/RANDOM/ANTI-PERSIST/COMPLEX)
• Dimension value (1.0-2.0)
• Color: Cyan (trending), gold (random), red (complex)

PHASE-SPACE:
• State (STRONG/ACTIVE/QUIET)
• Normalized magnitude value
• Parameters display: d=5 τ=3

CAUSAL SECTION:

CAUSAL:
• Direction (BULL/BEAR/NEUTRAL)
• Net flow value
• Flow indicator: →P (to price), P← (from price), ○ (neutral)

V→P:
• Volume-to-price transfer entropy
• Small display showing specific TE value

DIMENSIONAL SECTION:

RESONANCE:
• Progress bar of absolute resonance
• Signed value (-1 to +1)
• Color-coded by direction

RECURRENCE:
• Recurrence rate percentage
• Determinism percentage display
• Color-coded: Green if high quality

STATE SECTION:

STATE:
• Current mode: EMERGENCE / RESONANCE / CHAOS / SCANNING
• Icon: 🚀 (emergence buy), 💫 (emergence sell), ▲ (resonance buy), ▼ (resonance sell), ⚠ (chaos), ◎ (scanning)
• Color-coded by state

SIGNALS:
• E: count of emergence signals
• R: count of resonance signals

⚙️ KEY PARAMETERS EXPLAINED

Phase Space Configuration:
Embedding Dimension (3-10, default 5): Reconstruction dimension
- Low (3-4): Simple dynamics, faster computation
- Medium (5-6): Balanced (recommended)
- High (7-10): Complex dynamics, more data needed
- Rule: d ≥ 2D+1 where D is true dimension

Time Delay (τ) (1-10, default 3): Embedding lag
- Fast markets: 1-2
- Normal: 3-4
- Slow markets: 5-10
- Optimal: First minimum of mutual information (often 2-4)

Recurrence Threshold (ε) (0.01-0.5, default 0.10): Phase space proximity
- Tight (0.01-0.05): Very similar states only
- Medium (0.08-0.15): Balanced
- Loose (0.20-0.50): Liberal matching

Entropy & Complexity:
Permutation Order (3-7, default 4): Pattern length
- Low (3): 6 patterns, fast but coarse
- Medium (4-5): 24-120 patterns, balanced
- High (6-7): 720-5040 patterns, fine-grained
- Note: Requires window >> order! for stability

Entropy Window (15-100, default 30): Lookback for entropy
- Short (15-25): Responsive to changes
- Medium (30-50): Stable measure
- Long (60-100): Very smooth, slow adaptation

Lyapunov Window (10-50, default 20): Stability estimation window
- Short (10-15): Fast chaos detection
- Medium (20-30): Balanced
- Long (40-50): Stable λ estimate

Causal Inference:
Enable Transfer Entropy (default ON): Causality analysis
- Keep ON for full system functionality

TE History Length (2-15, default 5): Causal lookback
- Short (2-4): Quick causal detection
- Medium (5-8): Balanced
- Long (10-15): Deep causal analysis

TE Discretization Bins (4-12, default 6): Binning granularity
- Few (4-5): Coarse, robust, needs less data
- Medium (6-8): Balanced
- Many (9-12): Fine-grained, needs more data

Phase Coherence:
Enable Phase Coherence (default ON): Synchronization detection
- Keep ON for emergence detection

Coherence Threshold (0.3-0.95, default 0.70): PLV requirement
- Loose (0.3-0.5): More signals, lower quality
- Balanced (0.6-0.75): Recommended
- Strict (0.8-0.95): Rare, highest quality

Hilbert Smoothing (3-20, default 8): Phase smoothing
- Low (3-5): Responsive, noisier
- Medium (6-10): Balanced
- High (12-20): Smooth, more lag

Fractal Analysis:

Enable Fractal Dimension (default ON): Complexity measurement
- Keep ON for full analysis

Fractal K-max (4-20, default 8): Scaling range
- Low (4-6): Faster, less accurate
- Medium (7-10): Balanced
- High (12-20): Accurate, slower

Fractal Window (30-200, default 50): FD lookback
- Short (30-50): Responsive FD
- Medium (60-100): Stable FD
- Long (120-200): Very smooth FD

Emergence Detection:

Emergence Threshold (0.5-0.95, default 0.75): Minimum coherence
- Sensitive (0.5-0.65): More signals
- Balanced (0.7-0.8): Recommended
- Strict (0.85-0.95): Rare signals

Require Causal Gate (default ON): TE confirmation
- ON: Only signal when causality confirms
- OFF: Allow signals without causal support

Require Stability Zone (default ON): Lyapunov filter
- ON: Only signal when λ < 0 (stable) or |λ| < 0.1 (critical)
- OFF: Allow signals in chaotic regimes (risky)

Signal Cooldown (1-50, default 5): Minimum bars between signals
- Fast (1-3): Rapid signal generation
- Normal (4-8): Balanced
- Slow (10-20): Very selective
- Ultra (25-50): Only major regime changes

Signal Configuration:

Momentum Period (5-50, default 14): ROC calculation
Structure Lookback (10-100, default 20): Support/resistance range
Volatility Period (5-50, default 14): ATR calculation
Volume MA Period (10-50, default 20): Volume normalization

Visual Settings:

• Customizable color scheme for all elements
• Toggle visibility for each layer independently
• Dashboard position (4 corners) and size (tiny/small/normal)

🎓 PROFESSIONAL USAGE PROTOCOL

Phase 1: System Familiarization (Week 1)

Goal: Understand complexity metrics and dashboard interpretation

Setup:
• Enable all features with default parameters
• Watch dashboard metrics for 500+ bars
• Do NOT trade yet

Actions:
• Observe emergence score patterns relative to price moves
• Note coherence threshold crossings and subsequent price action
• Watch entropy regime transitions (ORDERED → COMPLEX → CHAOTIC)
• Correlate Lyapunov state with signal reliability
• Track which signals appear (emergence vs resonance frequency)

Key Learning:
• When does emergence peak? (usually before major moves)
• What entropy regime produces best signals? (typically ORDERED or MODERATE)
• Does your instrument respect stability zones? (stable λ = better signals)

Phase 2: Parameter Optimization (Week 2)

Goal: Tune system to instrument characteristics

Requirements:
• Understand basic dashboard metrics from Phase 1
• Have 1000+ bars of history loaded

Embedding Dimension & Time Delay:
• If signals very rare: Try lower dimension (d=3-4) or shorter delay (τ=2)
• If signals too frequent: Try higher dimension (d=6-7) or longer delay (τ=4-5)
• Sweet spot: 4-8 emergence signals per 100 bars

Coherence Threshold:
• Check dashboard: What's typical coherence range?
• If coherence rarely exceeds 0.70: Lower threshold to 0.60-0.65
• If coherence often >0.80: Can raise threshold to 0.75-0.80
• Goal: Signals fire during top 20-30% of coherence values

Emergence Threshold:
• If too few signals: Lower to 0.65-0.70
• If too many signals: Raise to 0.80-0.85
• Balance with coherence threshold—both must be met

Phase 3: Signal Quality Assessment (Weeks 3-4)

Goal: Verify signals have edge via paper trading

Requirements:
• Parameters optimized per Phase 2
• 50+ signals generated
• Detailed notes on each signal

Paper Trading Protocol:
• Take EVERY emergence signal (★ and ◆)
• Optional: Take resonance signals (▲/▼) separately to compare
• Use simple exit: 2R target, 1R stop (ATR-based)
• Track: Win rate, average R-multiple, maximum consecutive losses

Quality Metrics:
Premium emergence (★): Should achieve >55% WR
Standard emergence (◆): Should achieve >50% WR
Resonance signals: Should achieve >45% WR
Overall: If <45% WR, system not suitable for this instrument/timeframe

Red Flags:
• Win rate <40%: Wrong instrument or parameters need major adjustment
• Max consecutive losses >10: System not working in current regime
• Profit factor <1.0: No edge despite complexity analysis

Phase 4: Regime Awareness (Week 5)

Goal: Understand which market conditions produce best signals

Analysis:
• Review Phase 3 trades, segment by:
- Entropy regime at signal (ORDERED vs COMPLEX vs CHAOTIC)
- Lyapunov state (STABLE vs CRITICAL vs CHAOTIC)
- Fractal regime (TRENDING vs RANDOM vs COMPLEX)

Findings (typical patterns):
• Best signals: ORDERED entropy + STABLE lyapunov + TRENDING fractal
• Moderate signals: MODERATE entropy + CRITICAL lyapunov + PERSISTENT fractal
• Avoid: CHAOTIC entropy or CHAOTIC lyapunov (require_stability filter should block these)

Optimization:
• If COMPLEX/CHAOTIC entropy produces losing trades: Consider requiring H < 0.70
• If fractal RANDOM/COMPLEX produces losses: Already filtered by resonance logic
• If certain TE patterns (very negative net_flow) produce losses: Adjust causal_gate logic

Phase 5: Micro Live Testing (Weeks 6-8)

Goal: Validate with minimal capital at risk

Requirements:
• Paper trading shows: WR >48%, PF >1.2, max DD <20%
• Understand complexity metrics intuitively
• Know which regimes work best from Phase 4

Setup:
• 10-20% of intended position size
• Focus on premium emergence signals (★) only initially
• Proper stop placement (1.5-2.0 ATR)

Execution Notes:
• Emergence signals can fire mid-bar as metrics update
• Use alerts for signal detection
• Entry on close of signal bar or next bar open
• DO NOT chase—if price gaps away, skip the trade

Comparison:
• Your live results should track within 10-15% of paper results
• If major divergence: Execution issues (slippage, timing) or parameters changed

Phase 6: Full Deployment (Month 3+)

Goal: Scale to full size over time

Requirements:
• 30+ micro live trades
• Live WR within 10% of paper WR
• Profit factor >1.1 live
• Max drawdown <15%
• Confidence in parameter stability

Progression:
• Months 3-4: 25-40% intended size
• Months 5-6: 40-70% intended size
• Month 7+: 70-100% intended size

Maintenance:
• Weekly dashboard review: Are metrics stable?
• Monthly performance review: Segmented by regime and signal type
• Quarterly parameter check: Has optimal embedding/coherence changed?

Advanced:
• Consider different parameters per session (high vs low volatility)
• Track phase space magnitude patterns before major moves
• Combine with other indicators for confluence

💡 DEVELOPMENT INSIGHTS & KEY BREAKTHROUGHS

The Phase Space Revelation:
Traditional indicators live in price-time space. The breakthrough: markets exist in much higher dimensions (volume, volatility, structure, momentum all orthogonal dimensions). Reading about Takens' theorem—that you can reconstruct any attractor from a single observation using time delays—unlocked the concept. Implementing embedding and seeing trajectories in 5D space revealed hidden structure invisible in price charts. Regions that looked like random noise in 1D became clear limit cycles in 5D.

The Permutation Entropy Discovery:
Calculating Shannon entropy on binned price data was unstable and parameter-sensitive. Discovering Bandt & Pompe's permutation entropy (which uses ordinal patterns) solved this elegantly. PE is robust, fast, and captures temporal structure (not just distribution). Testing showed PE < 0.5 periods had 18% higher signal win rate than PE > 0.7 periods. Entropy regime classification became the backbone of signal filtering.

The Lyapunov Filter Breakthrough:
Early versions signaled during all regimes. Win rate hovered at 42%—barely better than random. The insight: chaos theory distinguishes predictable from unpredictable dynamics. Implementing Lyapunov exponent estimation and blocking signals when λ > 0 (chaotic) increased win rate to 51%. Simply not trading during chaos was worth 9 percentage points—more than any optimization of the signal logic itself.

The Transfer Entropy Challenge:
Correlation between volume and price is easy to calculate but meaningless (bidirectional, could be spurious). Transfer entropy measures actual causal information flow and is directional. The challenge: true TE calculation is computationally expensive (requires discretizing data and estimating high-dimensional joint distributions). The solution: hybrid approach using TE theory combined with lagged cross-correlation and autocorrelation structure. Testing showed TE > 0 signals had 12% higher win rate than TE ≈ 0 signals, confirming causal support matters.

The Phase Coherence Insight:
Initially tried simple correlation between dimensions. Not predictive. Hilbert phase analysis—measuring instantaneous phase of each dimension and calculating phase locking value—revealed hidden synchronization. When PLV > 0.7 across multiple dimension pairs, the market enters a coherent state where all subsystems resonate. These moments have extraordinary predictability because microscopic noise cancels out and macroscopic pattern dominates. Emergence signals require high PLV for this reason.

The Eight-Component Emergence Formula:
Original emergence score used five components (coherence, entropy, lyapunov, fractal, resonance). Performance was good but not exceptional. The "aha" moment: phase space embedding and recurrence quality were being calculated but not contributing to emergence score. Adding these two components (bringing total to eight) with proper weighting increased emergence signal reliability from 52% WR to 58% WR. All calculated metrics must contribute to the final score. If you compute something, use it.

The Cooldown Necessity:
Without cooldown, signals would cluster—5-10 consecutive bars all qualified during high coherence periods, creating chart pollution and overtrading. Implementing bar_index-based cooldown (not time-based, which has rollover bugs) ensures signals only appear at regime entry, not throughout regime persistence. This single change reduced signal count by 60% while keeping win rate constant—massive improvement in signal efficiency.

🚨 LIMITATIONS & CRITICAL ASSUMPTIONS

What This System IS NOT:
NOT Predictive: NEXUS doesn't forecast prices. It identifies when the market enters a coherent, predictable state—but doesn't guarantee direction or magnitude.

NOT Holy Grail: Typical performance is 50-58% win rate with 1.5-2.0 avg R-multiple. This is probabilistic edge from complexity analysis, not certainty.

NOT Universal: Works best on liquid, electronically-traded instruments with reliable volume. Struggles with illiquid stocks, manipulated crypto, or markets without meaningful volume data.

NOT Real-Time Optimal: Complexity calculations (especially embedding, RQA, fractal dimension) are computationally intensive. Dashboard updates may lag by 1-2 seconds on slower connections.

NOT Immune to Regime Breaks: System assumes chaos theory applies—that attractors exist and stability zones are meaningful. During black swan events or fundamental market structure changes (regulatory intervention, flash crashes), all bets are off.

Core Assumptions:
1. Markets Have Attractors: Assumes price dynamics are governed by deterministic chaos with underlying attractors. Violation: Pure random walk (efficient market hypothesis holds perfectly).

2. Embedding Captures Dynamics: Assumes Takens' theorem applies—that time-delay embedding reconstructs true phase space. Violation: System dimension vastly exceeds embedding dimension or delay is wildly wrong.

3. Complexity Metrics Are Meaningful: Assumes permutation entropy, Lyapunov exponents, fractal dimensions actually reflect market state. Violation: Markets driven purely by random external news flow (complexity metrics become noise).

4. Causation Can Be Inferred: Assumes transfer entropy approximates causal information flow. Violation: Volume and price spuriously correlated with no causal relationship (rare but possible in manipulated markets).

5. Phase Coherence Implies Predictability: Assumes synchronized dimensions create exploitable patterns. Violation: Coherence by chance during random period (false positive).

6. Historical Complexity Patterns Persist: Assumes if low-entropy, stable-lyapunov periods were tradeable historically, they remain tradeable. Violation: Fundamental regime change (market structure shifts, e.g., transition from floor trading to HFT).

Performs Best On:
• ES, NQ, RTY (major US index futures - high liquidity, clean volume data)
• Major forex pairs: EUR/USD, GBP/USD, USD/JPY (24hr markets, good for phase analysis)
• Liquid commodities: CL (crude oil), GC (gold), NG (natural gas)
• Large-cap stocks: AAPL, MSFT, GOOGL, TSLA (>$10M daily volume, meaningful structure)
• Major crypto on reputable exchanges: BTC, ETH on Coinbase/Kraken (avoid Binance due to manipulation)

Performs Poorly On:
• Low-volume stocks (<$1M daily volume) - insufficient liquidity for complexity analysis
• Exotic forex pairs - erratic spreads, thin volume
• Illiquid altcoins - wash trading, bot manipulation invalidates volume analysis
• Pre-market/after-hours - gappy, thin, different dynamics
• Binary events (earnings, FDA approvals) - discontinuous jumps violate dynamical systems assumptions
• Highly manipulated instruments - spoofing and layering create false coherence

Known Weaknesses:
Computational Lag: Complexity calculations require iterating over windows. On slow connections, dashboard may update 1-2 seconds after bar close. Signals may appear delayed.

Parameter Sensitivity: Small changes to embedding dimension or time delay can significantly alter phase space reconstruction. Requires careful calibration per instrument.

Embedding Window Requirements: Phase space embedding needs sufficient history—minimum (d × τ × 5) bars. If embedding_dimension=5 and time_delay=3, need 75+ bars. Early bars will be unreliable.

Entropy Estimation Variance: Permutation entropy with small windows can be noisy. Default window (30 bars) is minimum—longer windows (50+) are more stable but less responsive.

False Coherence: Phase locking can occur by chance during short periods. Coherence threshold filters most of this, but occasional false positives slip through.

Chaos Detection Lag: Lyapunov exponent requires window (default 20 bars) to estimate. Market can enter chaos and produce bad signal before λ > 0 is detected. Stability filter helps but doesn't eliminate this.

Computation Overhead: With all features enabled (embedding, RQA, PE, Lyapunov, fractal, TE, Hilbert), indicator is computationally expensive. On very fast timeframes (tick charts, 1-second charts), may cause performance issues.

⚠️ RISK DISCLOSURE

Trading futures, forex, stocks, options, and cryptocurrencies involves substantial risk of loss and is not suitable for all investors. Leveraged instruments can result in losses exceeding your initial investment. Past performance, whether backtested or live, is not indicative of future results.

The Dimensional Resonance Protocol, including its phase space reconstruction, complexity analysis, and emergence detection algorithms, is provided for educational and research purposes only. It is not financial advice, investment advice, or a recommendation to buy or sell any security or instrument.

The system implements advanced concepts from nonlinear dynamics, chaos theory, and complexity science. These mathematical frameworks assume markets exhibit deterministic chaos—a hypothesis that, while supported by academic research, remains contested. Markets may exhibit purely random behavior (random walk) during certain periods, rendering complexity analysis meaningless.

Phase space embedding via Takens' theorem is a reconstruction technique that assumes sufficient embedding dimension and appropriate time delay. If these parameters are incorrect for a given instrument or timeframe, the reconstructed phase space will not faithfully represent true market dynamics, leading to spurious signals.

Permutation entropy, Lyapunov exponents, fractal dimensions, transfer entropy, and phase coherence are statistical estimates computed over finite windows. All have inherent estimation error. Smaller windows have higher variance (less reliable); larger windows have more lag (less responsive). There is no universally optimal window size.

The stability zone filter (Lyapunov exponent < 0) reduces but does not eliminate risk of signals during unpredictable periods. Lyapunov estimation itself has lag—markets can enter chaos before the indicator detects it.

Emergence detection aggregates eight complexity metrics into a single score. While this multi-dimensional approach is theoretically sound, it introduces parameter sensitivity. Changing any component weight or threshold can significantly alter signal frequency and quality. Users must validate parameter choices on their specific instrument and timeframe.

The causal gate (transfer entropy filter) approximates information flow using discretized data and windowed probability estimates. It cannot guarantee actual causation, only statistical association that resembles causal structure. Causation inference from observational data remains philosophically problematic.

Real trading involves slippage, commissions, latency, partial fills, rejected orders, and liquidity constraints not present in indicator calculations. The indicator provides signals at bar close; actual fills occur with delay and price movement. Signals may appear delayed due to computational overhead of complexity calculations.

Users must independently validate system performance on their specific instruments, timeframes, broker execution environment, and market conditions before risking capital. Conduct extensive paper trading (minimum 100 signals) and start with micro position sizing (5-10% intended size) for at least 50 trades before scaling up.

Never risk more capital than you can afford to lose completely. Use proper position sizing (0.5-2% risk per trade maximum). Implement stop losses on every trade. Maintain adequate margin/capital reserves. Understand that most retail traders lose money. Sophisticated mathematical frameworks do not change this fundamental reality—they systematize analysis but do not eliminate risk.

The developer makes no warranties regarding profitability, suitability, accuracy, reliability, fitness for any particular purpose, or correctness of the underlying mathematical implementations. Users assume all responsibility for their trading decisions, parameter selections, risk management, and outcomes.

By using this indicator, you acknowledge that you have read, understood, and accepted these risk disclosures and limitations, and you accept full responsibility for all trading activity and potential losses.

📁 DOCUMENTATION

The Dimensional Resonance Protocol is fundamentally a statistical complexity analysis framework. The indicator implements multiple advanced statistical methods from academic research:

Permutation Entropy (Bandt & Pompe, 2002): Measures complexity by analyzing distribution of ordinal patterns. Pure statistical concept from information theory.

Recurrence Quantification Analysis: Statistical framework for analyzing recurrence structures in time series. Computes recurrence rate, determinism, and diagonal line statistics.

Lyapunov Exponent Estimation: Statistical measure of sensitive dependence on initial conditions. Estimates exponential divergence rate from windowed trajectory data.

Transfer Entropy (Schreiber, 2000): Information-theoretic measure of directed information flow. Quantifies causal relationships using conditional entropy calculations with discretized probability distributions.

Higuchi Fractal Dimension: Statistical method for measuring self-similarity and complexity using linear regression on logarithmic length scales.

Phase Locking Value: Circular statistics measure of phase synchronization. Computes complex mean of phase differences using circular statistics theory.

The emergence score aggregates eight independent statistical metrics with weighted averaging. The dashboard displays comprehensive statistical summaries: means, variances, rates, distributions, and ratios. Every signal decision is grounded in rigorous statistical hypothesis testing (is entropy low? is lyapunov negative? is coherence above threshold?).

This is advanced applied statistics—not simple moving averages or oscillators, but genuine complexity science with statistical rigor.

Multiple oscillator-type calculations contribute to dimensional analysis:

Phase Analysis: Hilbert transform extracts instantaneous phase (0 to 2π) of four market dimensions (momentum, volume, volatility, structure). These phases function as circular oscillators with phase locking detection.

Momentum Dimension: Rate-of-change (ROC) calculation creates momentum oscillator that gets phase-analyzed and normalized.

Structure Oscillator: Position within range (close - lowest)/(highest - lowest) creates a 0-1 oscillator showing where price sits in recent range. This gets embedded and phase-analyzed.

Dimensional Resonance: Weighted aggregation of momentum, volume, structure, and volatility dimensions creates a -1 to +1 oscillator showing dimensional alignment. Similar to traditional oscillators but multi-dimensional.

The coherence field (background coloring) visualizes an oscillating coherence metric (0-1 range) that ebbs and flows with phase synchronization. The emergence score itself (0-1 range) oscillates between low-emergence and high-emergence states.

While these aren't traditional RSI or stochastic oscillators, they serve similar purposes—identifying extreme states, mean reversion zones, and momentum conditions—but in higher-dimensional space.

Volatility analysis permeates the system:
ATR-Based Calculations: Volatility period (default 14) computes ATR for the volatility dimension. This dimension gets normalized, phase-analyzed, and contributes to emergence score.

Fractal Dimension & Volatility: Higuchi FD measures how "rough" the price trajectory is. Higher FD (>1.6) correlates with higher volatility/choppiness. FD < 1.4 indicates smooth trends (lower effective volatility).

Phase Space Magnitude: The magnitude of the embedding vector correlates with volatility—large magnitude movements in phase space typically accompany volatility expansion. This is the "energy" of the market trajectory.

Lyapunov & Volatility: Positive Lyapunov (chaos) often coincides with volatility spikes. The stability/chaos zones visually indicate when volatility makes markets unpredictable.

Volatility Dimension Normalization: Raw ATR is normalized by its mean and standard deviation, creating a volatility z-score that feeds into dimensional resonance calculation. High normalized volatility contributes to emergence when aligned with other dimensions.

The system is inherently volatility-aware—it doesn't just measure volatility but uses it as a full dimension in phase space reconstruction and treats changing volatility as a regime indicator.

CLOSING STATEMENT

DRP doesn't trade price—it trades phase space structure. It doesn't chase patterns—it detects emergence. It doesn't guess at trends—it measures coherence.

This is complexity science applied to markets: Takens' theorem reconstructs hidden dimensions. Permutation entropy measures order. Lyapunov exponents detect chaos. Transfer entropy reveals causation. Hilbert phases find synchronization. Fractal dimensions quantify self-similarity.

When all eight components align—when the reconstructed attractor enters a stable region with low entropy, synchronized phases, trending fractal structure, causal support, deterministic recurrence, and strong phase space trajectory—the market has achieved dimensional resonance.

These are the highest-probability moments. Not because an indicator said so. Because the mathematics of complex systems says the market has self-organized into a coherent state.

Most indicators see shadows on the wall. DRP reconstructs the cave.

"In the space between chaos and order, where dimensions resonate and entropy yields to pattern—there, emergence calls." DRP

Taking you to school. — Dskyz, Trade with insight. Trade with anticipation.
Phát hành các Ghi chú
Removed some unneeded code.

Thông báo miễn trừ trách nhiệm

Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.