Wave Conflict Detector

Wave Conflict Detector: Identifying Pivot Conditions Through Wave Interference Analysis
Wave Conflict Detector applies wave interference principles from physics to dual-EMA analysis, identifying potential pivot conditions by measuring phase relationships and amplitude states between two moving average waves. Unlike traditional EMA crossover systems that signal on wave intersection, this indicator measures the directional alignment (phase) and interaction strength (interference amplitude) between wave states to identify conditions where wave mechanics suggest potential reversal zones.
The indicator combines two analytical components: velocity-based phase difference calculation that measures whether waves are moving in the same or opposite directions, and normalized interference amplitude that quantifies the degree of wave reinforcement or cancellation. This creates a regime-classification system with visual feedback showing when waves are aligned (constructive state) versus opposed (destructive state).
What Makes This Approach Different
Phase Relationship Measurement
The core analytical method is extracting phase alignment from wave velocities rather than simply measuring EMA separation. The system calculates the first derivative (bar-to-bar change) of each EMA, creating velocity measurements: v₁ = ψ₁ - ψ₁[1] and v₂ = ψ₂ - ψ₂[1]. These velocities are combined through normalized correlation: Φ = (v₁ × v₂) / |v|², producing an alignment value ranging from -1 (perfect opposition) to +1 (perfect alignment).
This alignment value is smoothed using EMA and converted to angular degrees: Δφ = (1 - Φ) × 90°, creating a phase difference measurement from 0° to 180°. This quantifies how much the waves are "fighting" each other directionally, independent of their separation distance. Two EMAs can be far apart yet moving in harmony (low phase difference), or close together yet moving in opposition (high phase difference).
This directional correlation approach differs from standard dual-EMA analysis by focusing on velocity alignment rather than positional crossovers.
Interference Amplitude Calculation
The interference formula implements wave superposition principles: I = (|ψ₁ + ψ₂|² - |ψ₁ - ψ₂|²) × Gain, which mathematically simplifies to I = 4 × ψ₁ × ψ₂ × Gain. This measures the product of both waves—when both are positive and large, interference is maximally constructive; when they have opposite signs or differing magnitudes, interference weakens.
The raw interference value is then normalized using adaptive statistical bounds calculated over a rolling window (default 100 bars). The system computes mean (μ) and standard deviation (σ) of raw interference, then applies bounds of μ ± 2σ, and normalizes to a 0-1 range. This creates a scale-invariant measurement that adapts automatically to different instruments and volatility regimes without requiring manual recalibration.
The combination of phase measurement and normalized amplitude creates a two-dimensional state space for classifying market conditions.
Dual-Mode Detection Architecture
The system offers two detection approaches that can be selected based on market conditions:
Interference Mode: Detects pivot conditions when normalized interference amplitude forms local peaks or troughs (current bar is higher/lower than both adjacent bars) AND exceeds the configured threshold. This identifies extremes in wave interaction strength.
Phase Mode: Detects pivot conditions when phase alignment reverses (crosses from positive to negative or vice versa) AND absolute phase difference exceeds the threshold. This identifies directional relationship changes between waves.
Both modes require price structure confirmation (traditional pivot high/low patterns) and minimum bar spacing to prevent over-signaling. This architecture allows traders to match detection sensitivity to market character—interference mode for amplitude-driven markets, phase mode for directional trend shifts.
Multi-Layer Visual System
The visualization approach uses hierarchical layers to display wave state information:
Foundation Layer: The two EMA waves (ψ₁ and ψ₂) plotted directly on the price chart, showing the underlying wave states being analyzed.
Background Layer: Color-coded zones showing regime state—green tint when phase alignment is positive (constructive interference), red tint when phase alignment is negative below -0.3 (destructive interference).
Dynamic Ribbon: A band centered on the wave average with width proportional to |ψ₁ - ψ₂| × (0.5 + interference_norm). This creates an adaptive channel that expands with interference strength and contracts during low-energy states.
Phase Field: Multi-frequency harmonic oscillations generated using three phase accumulators driven by interference amplitude, phase alignment, and accumulated phase rotation. Multiple sine-wave layers create visual texture that becomes erratic during wave conflict conditions and smooth during aligned states.
Particle System: Floating symbols whose density is proportional to interference amplitude, creating a visual intensity indicator.
Each visual component displays non-redundant information about the wave state system.
Core Calculation Methodology
Wave State Generation
Two exponential moving averages are calculated using configurable lengths (default 8 and 21 bars):
- ψ₁ = EMA(close, fastLen) — fast wave component
- ψ₂ = EMA(close, slowLen) — slow wave component
These serve as the base wave functions for all subsequent analysis.
Velocity Extraction
First derivatives are computed as simple bar-to-bar differences:
- psi1_velocity = ψ₁ - ψ₁[1]
- psi2_velocity = ψ₂ - ψ₂[1]
These represent the "motion" of each wave through price-time space.
Phase Alignment Calculation
The velocity product and magnitude are calculated:
- velocity_product = v₁ × v₂
- velocity_magnitude = √(v₁² + v₂²)
Phase alignment is computed as:
- phase_alignment = velocity_product / (velocity_magnitude²)
This is smoothed using EMA of configurable length (default 5) and converted to degrees:
- phase_degrees = (1 - phase_alignment_smooth) × 90
Interference Amplitude Processing
Raw interference is calculated:
- interference_raw = (constructive_amplitude - destructive_amplitude) × gain
- where constructive_amplitude = (ψ₁ + ψ₂)²
- and destructive_amplitude = (ψ₁ - ψ₂)²
Statistical normalization is applied:
- interference_mean = SMA(interference_raw, normalizationLen)
- interference_std = StdDev(interference_raw, normalizationLen)
- upper_bound = mean + 2 × std
- lower_bound = mean - 2 × std
- interference_norm = (interference_raw - lower_bound) / (upper_bound - lower_bound), clamped to [0,1]
State Classification
Three regime states are identified:
- Constructive: phase_alignment_smooth > 0 (waves moving in same direction)
- Destructive: phase_alignment_smooth < -0.3 (waves moving in opposite directions)
- Neutral: phase_alignment between -0.3 and 0 (weak directional correlation)
Pivot Detection Logic
In Interference Mode:
- High pivots: interference_norm[1] > interference_norm[0] AND interference_norm[1] > interference_norm[2] AND interference_norm[1] > threshold AND price forms pivot high AND spacing requirement met
- Low pivots: interference_norm shows local trough using opposite conditions
In Phase Mode:
- Pivots: phase alignment reverses sign AND absolute phase_degrees > threshold AND price forms pivot high/low AND spacing requirement met
All conditions must be true for a signal to generate.
Dashboard Metrics System
The dashboard displays real-time calculations:
- I (Interference): Normalized amplitude shown as bar gauge and percentage
- Δφ (Phase): Phase difference shown as bar gauge and degrees
- ψ₁ and ψ₂: Current wave values in price units
- Wave Separation: |ψ₁ - ψ₂| with directional indicator
- STATE: Current regime classification (CONSTRUCTIVE/DESTRUCTIVE/NEUTRAL)
- PIVOT Probability: Composite score calculated as interference_norm × (phase_degrees/180) × 100
The interference matrix shows historical heatmap data across four metrics (interference amplitude, phase difference, constructive flags, destructive flags) over the configurable number of bars.
How to Use This Indicator
Initial Configuration
Apply the indicator to your chart with default settings. The fast wave length (default 8) should be adjusted to match short-term price swings for your instrument and timeframe. The slow wave length (default 21) should be 2-4 times the fast length to create adequate wave separation. Enable the dashboard (recommended position: top right) to monitor regime state and metrics in real-time.
Signal Interpretation
High Pivot Marker (▼ Red Triangle): Appears above price bars when a bearish pivot condition is detected. This indicates that price formed a swing high, the selected detection criteria were met (interference peak or phase reversal depending on mode), threshold requirements were satisfied, and the minimum spacing filter passed. This represents a potential reversal zone where wave mechanics suggest downward directional change conditions.
Low Pivot Marker (▲ Green Triangle): Appears below price bars when a bullish pivot condition is detected. This indicates that price formed a swing low and all detection criteria aligned. This represents a potential reversal zone where wave mechanics suggest upward directional change conditions.
Dashboard STATE Reading
The STATE field shows current wave relationship:
- "🟢 CONSTRUCTIVE": Waves are moving in the same direction (phase alignment positive). This suggests trend continuation conditions where waves are reinforcing each other.
- "🔴 DESTRUCTIVE": Waves are moving in opposite directions (phase alignment below -0.3). This suggests reversal-prone conditions where waves are conflicting.
- "🟡 NEUTRAL": Weak directional correlation between waves. This suggests ranging or transitional conditions.
Use STATE for regime awareness rather than specific entry signals.
Interference and Phase Metrics
Monitor the I (Interference) percentage:
- Above 70%: High amplitude state, significant wave interaction
- 40-70%: Moderate amplitude state
- Below 40%: Low amplitude state, weak interaction
Monitor the Δφ (Phase) degrees:
- Above 120°: Significant wave opposition (destructive conditions)
- 60-120°: Transitional phase relationship
- Below 60°: Wave alignment (constructive conditions)
The PIVOT probability metric combines both: high values (>70%) indicate conditions where both amplitude and phase suggest elevated pivot formation potential.
Trading Workflow Example
Step 1 - Regime Check: Observe dashboard STATE to understand current wave relationship. CONSTRUCTIVE states favor trend-following approaches, DESTRUCTIVE states suggest reversal-prone conditions.
Step 2 - Metric Monitoring: Watch I% and Δφ values. Rising interference with high phase difference indicates building wave conflict.
Step 3 - Visual Confirmation: Observe amplitude ribbon width (expanding = active state) and phase field texture (chaotic = conflict conditions, smooth = aligned conditions).
Step 4 - Signal Wait: Wait for confirmed pivot marker (▼ or ▲) rather than anticipating based on metrics alone. The marker indicates all detection criteria have aligned.
Step 5 - Entry Decision: Use pivot markers as potential reversal zones. Combine with other analysis methods such as support/resistance levels, volume confirmation, and higher timeframe bias for entry decisions.
Step 6 - Risk Management: Place stops beyond recent swing structure or ribbon edges. Monitor dashboard STATE—if it flips to CONSTRUCTIVE in trade direction, the reversal may be confirmed; if PIVOT% drops significantly, conditions may be weakening.
Step 7 - Exit Criteria: Consider exits when opposite pivot marker appears, STATE changes unfavorably, or standard technical targets are reached.
Parameter Optimization Guidelines
Fast Wave Length: Adjust to match short-term swing frequency. Shorter values (5-8) for active trading on lower timeframes, longer values (13-20) for swing trading on higher timeframes.
Slow Wave Length: Should maintain 2-4x ratio with fast length. Shorter values create more interference cycles, longer values create more stable baseline.
Phase Detection Length: Smoothing for phase alignment. Lower values (3-5) for responsive detection, higher values (8-12) for stable readings with less sensitivity.
Interference Gain: Amplification multiplier. Lower values (0.5-1.0) for conservative detection, higher values (1.5-2.5) for more sensitive detection.
Normalization Period: Rolling window for statistical bounds. Shorter periods (50-100) adapt quickly to volatility changes, longer periods (150-300) provide more stable normalization.
Interference Threshold: Minimum amplitude to trigger signals. Lower values (0.50-0.60) generate more signals, higher values (0.70-0.85) are more selective.
Phase Threshold: Minimum phase difference in degrees. Lower values (90-110) are more permissive, higher values (140-170) require stronger opposition.
Min Pivot Spacing: Bars between signals. Match to average swing duration on your timeframe—tighter spacing (3-8 bars) for scalping, wider spacing (15-30 bars) for swing trading.
Best Performance Conditions
This approach works better in markets with:
- Clear swing structure where EMA-based wave analysis is meaningful
- Sufficient volatility for wave separation to develop
- Periodic oscillation between trending and ranging states
- Liquid instruments where EMAs reflect true price flow
This approach may be less effective in:
- Extremely choppy conditions with no directional persistence
- Very low volatility environments where wave separation is minimal
- Gap-heavy instruments where price discontinuities disrupt wave continuity
- Parabolic moves where waves cannot keep pace with price velocity
The system adapts by reducing signal frequency in poor conditions—when interference stays below threshold or phase alignment remains neutral, pivot markers will not appear.
Visual Performance Optimization
The phase field and particle systems are computationally intensive. If experiencing chart lag:
- Reduce Phase Field Layers from 5 to 2-3 (significant performance improvement)
- Lower Particle Density from 3 to 1 (reduces label creation overhead)
- Disable Phase Field entirely (removes most intensive calculations)
- Decrease Matrix History Bars to 15-20 (reduces table computation load)
The core wave analysis and pivot detection continue to function with all visual elements disabled.
Important Disclaimers
This indicator is an analytical tool that measures phase relationships and interference amplitude between two exponential moving averages. It identifies conditions where these wave mechanics suggest potential pivot zones based on historical price data analysis. It should not be used as a standalone trading system.
The phase and interference calculations are deterministic mathematical formulas applied to EMA values. These measurements describe current and historical wave relationships but do not predict future price movements. Past wave patterns and pivot markers do not guarantee future market behavior will follow similar patterns.
All trading involves risk. The pivot markers represent analytical conditions where wave mechanics align with specific thresholds, not certainty of directional change. Use appropriate risk management, position sizing, and combine with additional confirmation methods such as support/resistance analysis, volume patterns, and multi-timeframe alignment. No indicator can eliminate false signals or guarantee profitable trades.
The spacing filter and threshold requirements are designed to reduce noise and over-signaling, but market conditions can change rapidly and render any analytical signal invalid. Always use stop losses and never risk capital you cannot afford to lose.
Technical Implementation Notes
All calculations execute on closed bars only—there is no repainting of signals or values. The normalization system requires approximately 100 bars of historical data to establish stable statistical bounds; values in the first 50-100 bars may be unstable as the rolling statistics converge.
Phase field arrays are fixed-size based on the complexity setting. Particle labels are capped at 80 total to prevent excessive memory usage. Dashboard and matrix tables update only on the last bar to minimize computational overhead. Particle generation is throttled to every 2 bars for performance. Phase accumulators use modulo arithmetic (% 2π) to prevent numerical overflow during extended operation.
The indicator has been tested across multiple timeframes (5-minute through daily) and multiple asset classes (forex, stocks, crypto, indices). It functions identically across all instruments due to the adaptive normalization approach.
Script sur invitation seulement
Seuls les utilisateurs approuvés par l'auteur peuvent accéder à ce script. Vous devrez demander et obtenir l'autorisation pour l'utiliser. Celle-ci est généralement accordée après paiement. Pour plus de détails, suivez les instructions de l'auteur ci-dessous ou contactez directement DskyzInvestments.
TradingView ne recommande PAS de payer ou d'utiliser un script à moins que vous ne fassiez entièrement confiance à son auteur et que vous compreniez comment il fonctionne. Vous pouvez également trouver des alternatives gratuites et open-source dans nos scripts communautaires.
Instructions de l'auteur
DAFETradingSystems.com
Clause de non-responsabilité
Script sur invitation seulement
Seuls les utilisateurs approuvés par l'auteur peuvent accéder à ce script. Vous devrez demander et obtenir l'autorisation pour l'utiliser. Celle-ci est généralement accordée après paiement. Pour plus de détails, suivez les instructions de l'auteur ci-dessous ou contactez directement DskyzInvestments.
TradingView ne recommande PAS de payer ou d'utiliser un script à moins que vous ne fassiez entièrement confiance à son auteur et que vous compreniez comment il fonctionne. Vous pouvez également trouver des alternatives gratuites et open-source dans nos scripts communautaires.
Instructions de l'auteur
DAFETradingSystems.com