Skip to content

Hilbert Transform - SineWave

HT_SINE generates a sine wave that represents the dominant cycle.

Method

tm.ta.ht_sine(source)

Inputs

ParameterArgument typeDescriptionDefault Value
sourcepd.SeriesInput data series-

Outputs

OutputType
sinenp.ndarray
leadsinenp.ndarray

Example usage

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