Hilbert Transform Instantaneous Trendline
get_ht_trendline(quotes)
Parameters
| name | type | notes |
|---|---|---|
quotes | Iterable[Quote] | Iterable of the Quote class or its sub-class. • See here for usage with pandas.DataFrame |
Historical quotes requirements
You must have at least 100 periods of quotes to cover the warmup periods.
quotes is an Iterable[Quote] collection of historical price quotes. It should have a consistent frequency (day, hour, minute, etc). See the Guide for more information.
Return
HTTrendlineResults[HTTrendlineResult]
- This method returns a time series of all available indicator values for the
quotesprovided. HTTrendlineResultsis just a list ofHTTrendlineResult.- It always returns the same number of elements as there are in the historical quotes.
- It does not return a single incremental indicator value.
- The first
6periods will haveNonevalues forsmooth_pricesince there’s not enough data to calculate. - The first
7periods will haveNonevalues fordc_periodssince there is not enough data to calculate; and are generally unreliable for the first ~25 periods.
⚞ Convergence warning: The first
100periods will have decreasing magnitude, convergence-related precision errors that can be as high as ~5% deviation in indicator values for earlier periods.
HTTrendlineResult
| name | type | notes |
|---|---|---|
date | datetime | Date |
trendline | float, Optional | HT Trendline |
dc_periods | int, Optional | Dominant cycle periods (smoothed) |
smooth_price | float, Optional | Weighted moving average of (H+L)/2 price |
Utilities
See Utilities and Helpers for more information.
Example
from stock_indicators import indicators
# This method is NOT a part of the library.
quotes = get_historical_quotes("SPY")
# Calculate HT Trendline
results = indicators.get_ht_trendline(quotes)
About Hilbert Transform Instantaneous Trendline
Created by John Ehlers, the Hilbert Transform Instantaneous Trendline is a 5-period trendline of high/low price that uses signal processing to reduce noise. [Discuss] 💬
