# `TAlib.Indicators.HT`
[🔗](https://github.com/benyblack/talib/blob/main/lib/indicators/ht.ex#L1)

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.

# `align`

# `core_stream`

# `ht_dcperiod`

```elixir
@spec ht_dcperiod([number()]) :: [float() | nil]
```

The Hilbert Transform - Dominant Cycle Period.

    iex> TAlib.Indicators.HT.ht_dcperiod(Enum.to_list(1..100)) |> List.last() |> Float.round(4)
    42.5223

# `ht_dcphase`

```elixir
@spec ht_dcphase([number()]) :: [float() | nil]
```

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

# `ht_phasor`

```elixir
@spec ht_phasor([number()]) :: %{
  inphase: [float() | nil],
  quadrature: [float() | nil]
}
```

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

# `ht_sine`

```elixir
@spec ht_sine([number()]) :: %{sine: [float() | nil], lead_sine: [float() | nil]}
```

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

# `ht_trendline`

```elixir
@spec ht_trendline([number()]) :: [float() | nil]
```

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

# `ht_trendmode`

```elixir
@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

# `scan`

---

*Consult [api-reference.md](api-reference.md) for complete listing*
