Skip to content

Hilbert Transform - Dominant Cycle Phase

HT_DCPHASE identifies the dominant cycle phase using Hilbert Transform.

Method

tm.ta.ht_dcphase(source)

Inputs

ParameterArgument typeDescriptionDefault Value
sourcepd.SeriesInput data series-

Outputs

OutputType
ht_dcphasenp.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 Phase
ht_dcphase = tm.ta.ht_dcphase(data.close)
# Get the last value and print
last_value = ht_dcphase.iloc[-1]
tm.log(f"Last value of Hilbert Transform - Dominant Cycle Phase is {last_value}")
# Plot the values of ht_dcphase
tm.plot(ht_dcphase, title="Hilbert Transform - Dominant Cycle Phase", overlay=False)