Skip to content

Hilbert Transform - Dominant Cycle Period

HT_DCPERIOD identifies the dominant cycle period using Hilbert Transform.

Method

tm.ta.ht_dcperiod(source)

Inputs

ParameterArgument typeDescriptionDefault Value
sourcepd.SeriesInput data series-

Outputs

OutputType
ht_dcperiodnp.ndarray

Example usage

strategy.py
import tradomate as tm
@tm.strategy()
def my_strategy(config: tm.TradomateConfig, data: tm.TradomateData):
# Trying out Hilbert Transform - Dominant Cycle Period
ht_dcperiod = tm.ta.ht_dcperiod(data.close)
# Get the last value and print
last_value = ht_dcperiod.iloc[-1]
tm.log(f"Last value of Hilbert Transform - Dominant Cycle Period is {last_value}")
# Plot the values of ht_dcperiod
tm.plot(ht_dcperiod, title="Hilbert Transform - Dominant Cycle Period", overlay=False)