Hilbert Transform - Trend vs Cycle Mode
HT_TRENDMODE identifies whether the market is in a trending or cyclical mode.
Method
tm.ta.ht_trendmode(source)
Inputs
Parameter | Argument type | Description | Default Value |
---|---|---|---|
source | pd.Series | Input data series | - |
Outputs
Output | Type |
---|---|
ht_trendmode | np.ndarray |
Example usage
import tradomate as tm
@tm.strategy()def my_strategy(config: tm.TradomateConfig, data: tm.TradomateData):
# Trying out Hilbert Transform - Trend vs Cycle Mode ht_trendmode = tm.ta.ht_trendmode(data.close)
# Get the last value and print last_value = ht_trendmode.iloc[-1] tm.log(f"Last value of Hilbert Transform - Trend vs Cycle Mode is {last_value}")
# Plot the values of ht_trendmode tm.plot(ht_trendmode, title="Hilbert Transform - Trend vs Cycle Mode", overlay=False)