Cycle Indicators¶
Cycle indicators use the Hilbert Transform for advanced market cycle analysis. These indicators help identify dominant market cycles and their phases.
HT_DCPERIOD - Dominant Cycle Period¶
HT_DCPERIOD
¶
Hilbert Transform - Dominant Cycle Period
This function uses the Hilbert Transform to identify the dominant cycle period in a price series. It analyzes market cycles and returns the period length of the dominant cycle.
Parameters¶
close : array-like Close prices array
Returns¶
np.ndarray Array of dominant cycle period values
Notes¶
- Compatible with TA-Lib HT_DCPERIOD signature
- Uses Numba JIT compilation for performance
- The first 32 values will be NaN (unstable period)
- Period values typically range from 6 to 50
- Based on John Ehlers' work on MESA (Maximum Entropy Spectrum Analysis)
Interpretation: - Values represent the length in bars of the dominant cycle - Lower values indicate shorter, faster cycles - Higher values indicate longer, slower cycles - Use to adapt other indicators to current market conditions - Helps identify cycle changes and market regime shifts
Common Uses: - Adaptive indicator periods - Cycle-based trading systems - Market regime identification - Optimizing moving average periods
Examples¶
import numpy as np from numta import HT_DCPERIOD close = np.random.randn(100) + 100 period = HT_DCPERIOD(close) print(period)
See Also¶
HT_DCPHASE : Hilbert Transform - Dominant Cycle Phase HT_PHASOR : Hilbert Transform - Phasor Components HT_TRENDMODE : Hilbert Transform - Trend vs Cycle Mode
Source code in src/numta/api/cycle_indicators.py
HT_DCPHASE - Dominant Cycle Phase¶
HT_DCPHASE
¶
Hilbert Transform - Dominant Cycle Phase
This function calculates the phase of the dominant cycle using the Hilbert Transform. The phase represents where in the cycle the market currently is, measured in degrees (0-360).
Parameters¶
close : array-like Close prices array
Returns¶
np.ndarray Array of dominant cycle phase values (in degrees)
Notes¶
- Compatible with TA-Lib HT_DCPHASE signature
- Uses Numba JIT compilation for performance
- The first 32 values will be NaN (unstable period)
- Phase values range from 0 to 360 degrees
- Based on John Ehlers' MESA techniques
Interpretation: - 0-90 degrees: Early cycle, potential accumulation - 90-180 degrees: Mid cycle, trending phase - 180-270 degrees: Late cycle, potential distribution - 270-360 degrees: Cycle completion, reversal zone - Phase crossing 0/360: Cycle restart signal
Common Uses: - Cycle position identification - Timing entry/exit points - Predicting cycle turns - Confirming trend changes
Examples¶
import numpy as np from numta import HT_DCPHASE close = np.random.randn(100) + 100 phase = HT_DCPHASE(close) print(phase)
See Also¶
HT_DCPERIOD : Hilbert Transform - Dominant Cycle Period HT_PHASOR : Hilbert Transform - Phasor Components HT_SINE : Hilbert Transform - SineWave
Source code in src/numta/api/cycle_indicators.py
HT_PHASOR - Phasor Components¶
HT_PHASOR
¶
Hilbert Transform - Phasor Components
This function returns the InPhase and Quadrature components of the Hilbert Transform. These components form a phasor representation of the market cycle.
Parameters¶
close : array-like Close prices array
Returns¶
tuple of np.ndarray (inphase, quadrature) - Two arrays with the phasor components
Notes¶
- Compatible with TA-Lib HT_PHASOR signature
- Uses Numba JIT compilation for performance
- The first 32 values will be NaN (unstable period)
- Returns two arrays: InPhase and Quadrature
- Based on John Ehlers' MESA analysis
Components: - InPhase: Real component of the phasor - Quadrature: Imaginary component of the phasor (90° phase shift) - Together they define the cycle's position and amplitude
Interpretation: - Magnitude = sqrt(InPhase² + Quadrature²) - Phase Angle = arctan(Quadrature / InPhase) - InPhase > 0, Quadrature > 0: First quadrant (0-90°) - InPhase < 0, Quadrature > 0: Second quadrant (90-180°) - InPhase < 0, Quadrature < 0: Third quadrant (180-270°) - InPhase > 0, Quadrature < 0: Fourth quadrant (270-360°)
Common Uses: - Advanced cycle analysis - Building custom cycle indicators - Phase and amplitude extraction - Cycle prediction algorithms - Component for other Hilbert Transform indicators
Examples¶
import numpy as np from numta import HT_PHASOR close = np.random.randn(100) + 100 inphase, quadrature = HT_PHASOR(close) magnitude = np.sqrt(inphase2 + quadrature2) phase = np.arctan2(quadrature, inphase) * 180 / np.pi
See Also¶
HT_DCPERIOD : Hilbert Transform - Dominant Cycle Period HT_DCPHASE : Hilbert Transform - Dominant Cycle Phase HT_SINE : Hilbert Transform - SineWave
Source code in src/numta/api/cycle_indicators.py
HT_SINE - SineWave¶
HT_SINE
¶
Hilbert Transform - SineWave
Source code in src/numta/api/cycle_indicators.py
HT_TRENDLINE - Instantaneous Trendline¶
HT_TRENDLINE
¶
Hilbert Transform - Instantaneous Trendline
Source code in src/numta/api/cycle_indicators.py
HT_TRENDMODE - Trend vs Cycle Mode¶
HT_TRENDMODE
¶
Hilbert Transform - Trend vs Cycle Mode