# Hurst Exponent

## Intro

• Name derives from Harold Edwin Hurst (1880–1978), who was the lead researcher in hydrology studies; the use of the standard notation H for the coefficient also relates to his name.
• Used as a measure of long-term memory of time series.
• Quantifies the tendency of a time series to revert to its mean or cluster in one direction.
• The Hurst exponent shows if a time series behaves in a random, trending, or mean-reverting way. It captures the speed autocorrelation decrease as the lag increases.
• Mean reversion assumes that the properties such as stock returns and volatility will revert to their long-term average over time. Mathematically, such a time series is described by an Ornstein–Uhlenbeck process.

## Definition

The Hurst exponent, H, is defined in terms of the asymptotic behaviour of the rescaled range as a function of the time span of a time series as follows:

\begin{align*} {\displaystyle \mathbb {E} \left[{\frac {R(n)}{S(n)}}\right]=Cn^{H}{\text{ as }}n\to \infty \,,} \end{align*}

where:
• $R(n)$ is the range of the first $n$ cumulative deviations from the mean
• $S(n)$ is the series (sum) of the first n standard deviations
• ${\displaystyle \mathbb {E} \left[x\right]}$ is the expected value
• $n$ is the time span of the observation (number of data points in a time series)
• $C$ is a constant.

• Traders use it to pick the right trading strategy for the current market conditions. For example, you do not want to trade a trend strategy if the Hurst exponent shows mean reverting market behavior.

### Use the Hurst exponent for strategy selection

• Hurst exponent ranges between 0 and 1.
• If $H < 0.5$, the market is mean reverting. Reversal strategies win in these markets. The closer the value is 0, the stronger the mean reversion.
• If $H = 0.5$ means the market is random. In this case, a trading strategy that relies on the market direction will lose money.
• If $H > 0.5$ the market is trending. Markets with a high Hurst exponent are perfect for trend-following strategies. The closer the value is to 1, the stronger the trend.

So, it’s better to first check the Hurst exponent before you start trading using a specific strategy.

### Implementation

List of things we want to do in this example:

1. Get stock price data using OpenBB SDK
2. Calculate the Hurst exponent
3. Determine the type of market: if the market is mean reverting, trending, or random?