Skip to content

Hilbert Transform - Instantaneous Trendline

Calculates a trendline using advanced mathematical transformations.

Method

tm.ta.ht_trendline(source)

Inputs

ParameterArgument typeDescriptionDefault Value
sourcepd.SeriesInput data series-

Outputs

OutputType
ht_trendlinenp.ndarray

Example usage

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