mlfinlab.features.directional_change
Implementation of directional change tools.
Module Contents
Classes
The Directional Change module contains functions and classes related to the |
- class DirectionalChange(time_series: pandas.Series, threshold: float = 0.05)
-
The Directional Change module contains functions and classes related to the detection of general price movement and feature generation based on direction split.
The implementation is based on the book Detecting Regime Change in Computational Finance by Jun Chen & Edward P K Tsang
- signal()
-
Function to implement directional change test over a financial time series of prices.
- Returns:
-
(pd.Series[int]) Series of directional change signals.
- total_price_movement() pandas.Series
-
Detecting Regime Change in Computational Finance, Snippet 2.2, page 12
Total price movement (TMV) is used to measure the percentage change from point A to point C, normalized by the threshold. It usually measures the total price change of a DC event and an OS event.
- Returns:
-
(pd.Series[float]) Total price movement.
- time_for_completion() pandas.Series
-
Detecting Regime Change in Computational Finance, Snippet 2.3, page 13
Time for completion of a trend indicator measures the amount of physical time (T) that it takes to complete a TMV trend.
- Returns:
-
(pd.Series[timedelta]) Time completion for a trend.
- time_adjusted_return() pandas.Series
-
Detecting Regime Change in Computational Finance, Snippet 2.4, page 13
Time adjusted return for directional change indicator measures the absolute return (R) in a trend. It is calculated by dividing the absolute TMV by the time interval T. It measures the percentage of price change per time unit.
- Returns:
-
(pd.Series[float]) Time adjusted return.