HomeMacro TrendsDetecting trends and mean reversion with the Hurst exponent

Detecting trends and mean reversion with the Hurst exponent

-

The Hurst exponent is a statistical measure of long-term memory of time series. The existence and form of such memory are of great interest in financial markets, as financial returns are not generally governed by random walks.
The Hurst exponent is a single scalar value that indicates if a time series is purely random, trending, or rather mean reverting. Thus, it can validate either momentum or mean-reverting strategies. The Hurst exponent uses the variance of a log price series to assess the rate of diffusive behavior. If a time series follows a random walk, its variance simply increases linearly with time elapsed. If instead variance increases with time to the power of an exponent, then a low (Hurst) exponent would indicate mean reversion and a high exponent trending behavior. The Hurst exponent depends on the period used for return calculation. For example, monthly returns can display a memory that is different from daily returns.
The Hurst exponent is estimated rather than calculated. Most methods regress rescaled ranges of the return series on the time span of observations. Code examples are available for Python and R.

The post is based on various articles that are linked next to the quotes below. Bracketed text and emphasis have been added for clarity.

What is the Hurst exponent?

“[The] Hurst exponent is a statistical measure which is used to study scaling properties in time series. The scaling property in time series refers to the patterns in financial asset prices which are repeated at different time scales…[The concept] was originally developed in hydrology for the practical matter of determining the optimum size of the dam for the Nile river by Harold Edwin Hurst [but] can help us classify the pattern of time series of prices under a certain time horizon.” [Bui and Ślepaczuk]

“Put simply, the Hurst exponent is used as a measure of the long-term memory of a time series…While investigating the fractal nature of financial markets [and] specifically, the tendency of a time series to regress strongly to its mean or to cluster in a direction…mathematician Benoit Mandelbrot introduced to fractal geometry…the term generalized Hurst Exponent.” [Mansukhani]

Notes:
Fractals are entities that…look the same under different levels of magnification; the parts that make it up look the same as the larger shape…Fractals can also involve randomness so that the similarity of parts to the whole can be of a statistical or average nature, rather than each piece being strictly identical at any scale…Fractal shapes are important in modern science (since the 1970s) because much of traditional scientific thought is based on calculus, which assumes that everything becomes smooth when observed at a fine enough scale. The recognition that there are characteristic shapes that do not become smooth was important.” [NECSI]
A fractal is an object or quantity that displays self-similarity, in a somewhat technical sense, on all scales. The object need not exhibit exactly the same structure at all scales, but the same ‘type’ of structures must appear on all scales.” [Mathworld]

“Estimating the Hurst exponent for a data set provides a measure of whether the data is a pure white noise random process or has underlying trends. Another way to state this is that a random process with an underlying trend has some degree of autocorrelation…When the autocorrelation has a very long decay this kind of Gaussian process is sometimes referred to as a long memory process. Processes that we might naively assume are purely white noise sometimes turn out to exhibit Hurst exponent statistics for long memory processes (they are ‘colored’ noise).” [Kaplan]

Why is the Hurst component relevant for financial markets?

“For many economists, a fundamental assumption of financial assets is that price changes are generated randomly without long-term memory. However,…price series persistence behavior is a well-documented property of many financial series. This property [is] known as long memory.” [Gómez-Águila, Sánchez-Granero and Trinidad-Segovia]

Financial markets can be seen as a complex mixture of deterministic chaotic systems and stochastic non-linear systems…[The] fractal market hypothesis stresses the chaotic part. Processes behind markets have their weak deterministic component, but they have a strong built-in randomness component…Additionally…markets are nonlinear feedback systems…This component brings reflexivity into the system, i.e., circular relationships between cause and effect…For example…precise market prediction would change markets completely…The Hurst exponent derived from fractal dimension describes chaotic properties of time series, and it tells us whether there is a long memory process in a time series or not.” [Kroha and Skoula]

A simplified view of the way stock prices evolve over time is that they follow a random walk…This model, that asset prices follow a random walk or Gaussian Brownian Motion, underlies the Black-Scholes model for pricing stock options…Actual stock prices do not follow a purely Gaussian Brownian Motion process. They have dependence (autocorrelation) where the change at time t has some dependence on the change at time t-1…Actual stock returns, especially daily returns, usually do not have a normal distribution. The curve of the distribution will have fatter tails than a normal distribution. The curve will also tend to be more ‘peaked’ and be thinner in the middle.” [Kaplan]

What do Hurst exponent values mean?

“The idea behind the Hurst Exponent H is that it can supposedly help us determine whether a time series is a random walk (H ~ 0.5), trending (H > 0.5) or mean reverting (H < 0.5) for a specific period of time.” [Longmore]

“The goal of the Hurst exponent [in financial markets research] is to provide us with a scalar value that will help us to identify (within the limits of statistical estimation) whether a series is mean reverting, random walking or trending. The idea behind the Hurst Exponent calculation is that we can use the variance of a log price series to assess the rate of diffusive behavior. For an arbitrary time lag τ, the variance is given by:

Var(τ) = E[(log(t+ τ) – log(t))2]

Since we are comparing the rate of diffusion to that of a geometric Brownian motion, we can use the fact that at large time lags we have that the variance is proportional to the time lag:

E[(log(t+ τ) – log(t))2] ~ τ

The key insight is that if any autocorrelations exist (i.e. any sequential price movements possess non-zero correlation) then the above relationship is not valid. Instead, it can be modified to include an exponent value 2*H, which gives us the Hurst Exponent value H :

E[(log(t+ τ) – log(t))2] ~ τ2*H

A time series can then be characterized in the following manner:

  • H < 0.5: The time series is mean reverting
  • H = 0.5: The time series is a geometric Brownian motion
  • H > 0.5: The time series is trending

In addition to characterization of the time series the Hurst Exponent also describes the extent to which a series behaves in the manner categorized. For instance, a value of  near 0 is a highly mean reverting series, while for  near 1 the series is strongly trending.” [Quantstart]

[There is]  a relationship between Hurst exponent (H) and market trends…A value of 0.5 indicates a true random process (a Brownian time series). A Hurst exponent value H, 0.5 < H < 1 indicates persistent behavior (e.g., a positive autocorrelation – a trend). A Hurst exponent value 0 < H < 0.5 indicates anti-persistent behavior (or negative autocorrelation – change of a trend). An H closer to one indicates a high risk of large and abrupt changes…The value of Hurst exponent changes with the length of time period used. For example, we measured for DAX index 0.54 for 1-day return time series and 0.82 for 50-days return time series. This means that 1-day returns correspond practically to white noise (Hurst exponent of white noise = 0.5), but the 50-days returns contain some trends.[Also] time series gain a long memory character when the return period increases. Moreover, their distributions move away from the Gaussian normal to so-called fat-tailed distributions.” [Kroha and Skoula]

How is the Hurst exponent applied in financial market research?

“The Hurst exponent can serve as a criterion to select either momentum or mean-reverting strategy…The Hurst exponent [can be used] to effectively select pairs from a portfolio of stocks for a pair trading strategy. As we know, pair trading takes advantage of the fact that the linear combination of two assets’ prices may be stationary, hence we can apply a mean-reverting strategy on the price spread of such pairs to make a profit.” [Bui and Ślepaczuk]

One of the key trading concepts in the quantitative toolbox is that of mean reversion. This process refers to a time series that displays a tendency to revert to its historical mean value. Mathematically, such a (continuous) time series is referred to as an Ornstein-Uhlenbeck process. This is in contrast to a random walk (Brownian motion), which has no “memory” of where it has been at each particular instance of time. The mean-reverting property of a time series can be exploited in order to produce profitable trading strategies.” [Quantstart]

“We…implemented, and tested a construction supporting the idea of Hurst exponent applicability to trading…We constructed a new technical indicator MH (Moving Hurst) based on Hurst exponent that describes chaotic properties of time series. Further, we stated and proved a hypothesis that this indicator can bring more profit than the very well known…Moving Averages Convergence Divergence that is based on moving averages of time series values.” [Kroha and Skoula]

How is the Hurst exponent estimated?

“To calculate the exponent, we need to divide the data into different [sample divisions by powers of 2, called chunks or subsamples, from few chunks with many observations to many chunks with few observations]…After dividing the data…we perform the following calculations on each chunk:

  • Step 1: We calculate the mean of the chunk.
  • Step 2: Then we calculate the standard deviation (S).
  • Step 3: Then we create a mean-centered series by subtracting the mean from the observations.
  • Step 4: Then we calculate the cumulative deviation by summing up the mean-centered values.
  • Step 5: Next, we calculate the range, which is the difference between the maximum value of the cumulative deviation and the minimum value of the cumulative deviation.
  • Step 6: We compute the ratio of the range (R) to the standard deviation. This is also known as the rescaled range.
  • Step 7: We compute the mean of each division and note it along with the number of samples in each chunk of that division.
  • Step 8: We calculate the logarithmic values for the size…and…rescaled range.

The Hurst exponent ‘H’ is nothing but the slope of the plot of each [division’s’ log(R/S) versus each range’s log(size). Here log(R/S) is the dependent…variable and log(size) is the independent.” [Singh, Divakar and Garg]

The Hurst exponent is not so much calculated as it is estimated. A variety of techniques exist for estimating the Hurst exponent…One must regress the rescaled range on the time span of observations. To do this, a time series of full length is divided into a number of shorter time series, and the rescaled range is calculated for each of the smaller time series.
For each chunk of observations, compute [i] the mean of the time series, [ii] a mean-centered series by subtracting the mean from the series, [iii] the cumulative deviation of the series from the mean by summing up the mean-centered values, [iv] the range, which is the difference between the maximum value of the cumulative deviation and the minimum value of the cumulative deviation, [v] the standard deviation of the mean-centered values, and [vi] the rescaled range by dividing the range by the standard deviation.
Finally [one must] average the rescaled range over all the chunks. The rescaled range and chunk size follows a power law, and the Hurst exponent is given by the exponent of this power law.” [Mansukhani]

Note:
A power law is a relationship in which a relative change in one quantity gives rise to a proportional relative change in the other quantity, independent of the initial size of those quantities…Power laws are very important because they reveal an underlying regularity in the properties of systems. Often highly complex systems have properties where the changes between phenomena at different scales is independent of which particular scales we are looking at…The properties of many natural and human systems follow power laws.” [NECSI]

“[Checking] that a time series is self-similar is highly recommended before making any estimations of the Hurst exponent; otherwise, the estimation is meaningless…Therefore, we provide a simple but powerful method to check the self-similarity condition…showing that pure price series may be generally but not always necessarily self-similar.” [Gómez-Águila, Sánchez-Granero and Trinidad-Segovia]

Python and R code examples

“The Hurst exponent is calculated using a method called rescaled range analysis. The basic idea behind rescaled range analysis is to calculate the range of the cumulative sum of a time series and compare it to the standard deviation of the series. This method involves calculating the cumulative sum of the time series, denoted by S(n), and the range of the cumulative sum, denoted by R(n). The Hurst exponent can then be calculated as follows:

H = R(n) / S(n)

where n is the length of the time series.” [Jha]

“This post is devoted to presenting and discussing some Python code for calculating Hurst. We determine Hurst by first calculating the standard deviation of the difference between a series and its lagged counterpart. We then repeat this calculation for a number of lags and plot the result as a function of the number of lags. If we plot this on a log-log scale, we end up with a straight line, the slope of which provides an estimate for the Hurst exponent.” [Longmore 1]

Hurst gives different results depending on how it is calculated; this begs the question of how to choose a calculation method intelligently so that we avoid choosing arbitrary parameters.” [Longmore 2]

“R code estimates the Hurst exponent of S&P 500 index returns for the sample period from 1/1/2000 to 8/1/2022…This post explains how to estimate the Hurst exponent which is usually used when implementing pairs trading strategy.” [Lee]

 

Editor
Editorhttps://research.macrosynergy.com
Ralph Sueppel is managing director for research and trading strategies at Macrosynergy. He has worked in economics and finance since the early 1990s for investment banks, the European Central Bank, and leading hedge funds.