Cycle
Cycle Indicators — Hilbert Transform-based cycle analysis.
All functions use a 63-bar lookback period (first 63 values are NaN).
Functions
HT_TRENDLINE — Hilbert Transform - Instantaneous Trendline HT_DCPERIOD — Hilbert Transform - Dominant Cycle Period HT_DCPHASE — Hilbert Transform - Dominant Cycle Phase HT_PHASOR — Hilbert Transform - Phasor Components (returns inphase, quadrature) HT_SINE — Hilbert Transform - SineWave (returns sine, leadsine) HT_TRENDMODE — Hilbert Transform - Trend vs Cycle Mode (1=trend, 0=cycle)
- ferro_ta.cycle.HT_DCPERIOD(close)[source]
Hilbert Transform - Dominant Cycle Period.
Estimates the current dominant cycle period in bars using the Hilbert Transform. Values are smoothed and clamped to [6, 50].
- Parameters:
close (array-like) – Sequence of closing prices.
- Returns:
Dominant cycle period values; first 63 entries are
NaN.- Return type:
- ferro_ta.cycle.HT_DCPHASE(close)[source]
Hilbert Transform - Dominant Cycle Phase.
Returns the instantaneous phase (in degrees) of the dominant cycle.
- Parameters:
close (array-like) – Sequence of closing prices.
- Returns:
Phase values in degrees; first 63 entries are
NaN.- Return type:
- ferro_ta.cycle.HT_PHASOR(close)[source]
Hilbert Transform - Phasor Components.
Returns the In-Phase (I) and Quadrature (Q) components of the Hilbert Transform. These represent the real and imaginary parts of the analytic signal derived from the price series.
- Parameters:
close (array-like) – Sequence of closing prices.
- Returns:
(inphase, quadrature)— two arrays; first 63 entries areNaN.- Return type:
- ferro_ta.cycle.HT_SINE(close)[source]
Hilbert Transform - SineWave.
Returns the sine and lead-sine (45-degree lead) of the dominant cycle phase. Used to detect cycle turning points.
- Parameters:
close (array-like) – Sequence of closing prices.
- Returns:
(sine, leadsine)— two arrays; first 63 entries areNaN.- Return type:
- ferro_ta.cycle.HT_TRENDLINE(close)[source]
Hilbert Transform - Instantaneous Trendline.
Computes the underlying trend of the price series using the Hilbert Transform. The trendline is the dominant-cycle-period average of the smoothed price.
- Parameters:
close (array-like) – Sequence of closing prices.
- Returns:
Trendline values; first 63 entries are
NaN.- Return type:
- ferro_ta.cycle.HT_TRENDMODE(close)[source]
Hilbert Transform - Trend vs Cycle Mode.
Returns 1 when the market is in a trending mode (dominant cycle period below 20 bars) and 0 when in a cycling mode.
- Parameters:
close (array-like) – Sequence of closing prices.
- Returns:
Array of 1 (trending) or 0 (cycling).
- Return type:
numpy.ndarray[int32]