This module contains technical indicators that help identify cyclical behavior in financial markets. These indicators are typically used to detect repeating patterns or oscillations in the market.
The Hilbert Transform - Instantaneous Trendline is used to smooth out price action and help identify the underlying trend of the market. It is based on the Hilbert Transform, which helps filter out noise in price data and highlights the dominant cycle.
df['inst_trendline'] = bta.hilbert_instantaneous_trendline(df, 'close')
df
(pandas.DataFrame): Input DataFrame containing a'close'
column.column
(str): Column to be used for the calculation. Default is'close'
.
- DataFrame: A DataFrame with a single
'inst_trendline'
column representing the smoothed trendline.
The Hilbert Transform - Dominant Cycle Period is used to identify the dominant cycle present in the market by analyzing price data. It helps detect the most prominent periodic behavior in the market.
df['dominant_cycle_period'] = bta.hilbert_dominant_cycle_period(df, 'close')
df
(pandas.DataFrame): Input DataFrame containing a'close'
column.column
(str): Column to be used for the calculation. Default is'close'
.
- DataFrame: A DataFrame with a single
'dominant_cycle_period'
column representing the dominant cycle length.
The Hilbert Transform - Dominant Cycle Phase measures the phase of the dominant cycle in the market. It can be used to identify turning points where price action shifts from one cycle phase to another.
df['dominant_cycle_phase'] = bta.hilbert_dominant_cycle_phase(df, 'close')
df
(pandas.DataFrame): Input DataFrame containing a'close'
column.column
(str): Column to be used for the calculation. Default is'close'
.
- DataFrame: A DataFrame with a single
'dominant_cycle_phase'
column representing the phase of the dominant cycle.
The Hilbert Transform - Dominant Cycle Phase Slope calculates the slope of the dominant cycle phase, which helps identify whether the cycle is accelerating or decelerating. This can be useful for detecting potential trend changes.
df['dominant_cycle_slope'] = bta.hilbert_dominant_cycle_phase_slope(df, 'close')
df
(pandas.DataFrame): Input DataFrame containing a'close'
column.column
(str): Column to be used for the calculation. Default is'close'
.
- DataFrame: A DataFrame with a single
'dominant_cycle_slope'
column representing the slope of the dominant cycle phase.
The Sinewave Indicator is a cycle-based indicator that helps identify potential turning points in the market by measuring the oscillation between bullish and bearish phases.
sinewave_df = bta.sinewave(df, 'close')
df['sinewave'] = sinewave_df['sinewave']
df['lead_sinewave'] = sinewave_df['lead_sinewave']
df
(pandas.DataFrame): Input DataFrame containing a'close'
column.column
(str): Column to be used for the calculation. Default is'close'
.
- DataFrame: A DataFrame with two columns:
'sinewave'
: The sinewave component.'lead_sinewave'
: The leading sinewave component, which may give early warning of trend changes.
The Time Series Forecast (TSF) is used to forecast future prices based on past price data. It uses a linear regression model to predict future price movements based on a given look-back period.
df['tsf'] = bta.time_series_forecast(df, 'close', lookback=14)
df
(pandas.DataFrame): Input DataFrame containing a'close'
column.column
(str): Column to be used for the calculation. Default is'close'
.lookback
(int): Number of periods to look back for the forecast. Default is14
.
- DataFrame: A DataFrame with a single
'tsf'
column representing the forecasted price.
The Two-Pole Super Smoother is a smoothing filter that reduces noise in price data while maintaining responsiveness to price changes. It is particularly useful for filtering out short-term fluctuations while highlighting trends.
df['super_smoother'] = bta.two_pole_super_smoother(df, 'close', period=14)
df
(pandas.DataFrame): Input DataFrame containing a'close'
column.column
(str): Column to be used for the calculation. Default is'close'
.period
(int): Period for the smoothing calculation. Default is14
.
- DataFrame: A DataFrame with a single
'super_smoother'
column representing the smoothed values.