Hilbert-transform cycle indicators (TA-Lib Cycle Indicators group), translated from the TA-Lib C reference implementation of John Ehlers' MESA machinery ("Rocket Science for Traders").
Every function takes prices oldest first and returns series aligned
with the input: the first 63 entries are nil (the fixed warmup of
the 4-bar WMA pre-smoother and the Hilbert transformer). TA-Lib's
configurable unstable-period machinery, which shifts where outputs
begin, is not mirrored. See TAlib for the remaining conventions.
Summary
Functions
The Hilbert Transform - Dominant Cycle Period.
The Hilbert Transform - Dominant Cycle Phase, in degrees.
The Hilbert Transform - Phasor Components: the in-phase (I1) and quadrature (Q1) series, as a map.
The Hilbert Transform - SineWave: sine and lead_sine (45 degrees
ahead), as a map.
The Hilbert Transform - Instantaneous Trendline: the raw price averaged over the dominant cycle and blended with its own recent values.
The Hilbert Transform - Trend vs Cycle Mode: 1 when the price is trending, 0 when it is cycling.
Functions
The Hilbert Transform - Dominant Cycle Period.
iex> TAlib.Indicators.HT.ht_dcperiod(Enum.to_list(1..100)) |> List.last() |> Float.round(4)
42.5223
The Hilbert Transform - Dominant Cycle Phase, in degrees.
iex> TAlib.Indicators.HT.ht_dcphase(Enum.to_list(1..100)) |> List.last() |> Float.round(4)
183.9149
The Hilbert Transform - Phasor Components: the in-phase (I1) and quadrature (Q1) series, as a map.
iex> values = TAlib.Indicators.HT.ht_phasor(Enum.to_list(1..100))
iex> Float.round(List.last(values.quadrature), 4)
-1.9195
The Hilbert Transform - SineWave: sine and lead_sine (45 degrees
ahead), as a map.
iex> values = TAlib.Indicators.HT.ht_sine(Enum.to_list(1..100))
iex> Float.round(List.last(values.sine), 4)
-0.0683
The Hilbert Transform - Instantaneous Trendline: the raw price averaged over the dominant cycle and blended with its own recent values.
iex> TAlib.Indicators.HT.ht_trendline(Enum.to_list(1..100)) |> List.last() |> Float.round(4)
76.85
@spec ht_trendmode([number()]) :: [0 | 1 | nil]
The Hilbert Transform - Trend vs Cycle Mode: 1 when the price is trending, 0 when it is cycling.
iex> TAlib.Indicators.HT.ht_trendmode(Enum.to_list(1..100)) |> List.last()
1