Hurst Exponent

My first try to implement Full Hurst Exponent .

The Hurst exponent is used as a measure of long-term memory of time series. It relates to the autocorrelations of the time series and the rate at which these decrease as the lag between pairs of values increases

The Hurst exponent is referred to as the "index of dependence" or "index of long-range dependence". It quantifies the relative tendency of a time series either to regress strongly to the mean or to cluster in a direction.

In short, depending on the value you can spot the trending / reversing market.
  • Values 0.5 to 1 - market trending
  • Values 0 to 0.5 - market tend to mean revert

Hurst Exponent is computed using Rescaled range (R/S) analysis.
I split the lookback period (N) in the number of shorter samples (for ex. N/2, N/4, N/8, etc.). Then I calculate rescaled range for each sample size.
The Hurst exponent is estimated by fitting the power law. Basically finding the slope of log(samples_size) to log( RS ).

You can choose lookback and sample sizes yourself. Max 8 possible at the moment, if you want to use less use 0 in inputs.

It's pretty computational intensive, so I added an input so you can limit from what date you want it to be calculated. If you hit the time limit in PineScript - limit the history you're using for calculations.


Please remember that past performance may not be indicative of future results.
Due to various factors, including changing market conditions, the strategy may no longer perform as good as in historical backtesting.
This post and the script don’t provide any financial advice.
Скрипт с открытым кодом

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.

Хотите использовать этот скрипт на графике?
PineScript Programming: https://qntly.com/pinepro
TradingView Essential: https://qntly.com/tve

Access to Pro Indic.: https://qntly.com/proind

YouTube: https://qntly.com/youtube
Discord: https://qntly.com/discord
Telegram: https://qntly.com/tel


500 монет
Nice try, very good script. I made a rescaled range HE before the array function was implemented on tv. Was going to update my code and publish it but didn't have the time. Now your script does the job with more efficient code. Good job.
Some small suggestions:
Regression slope is best when there are ten or more points on log-log plot.
For rescaled range HE, you can't really tell if there's significant autocorrelation by just looking at if it's above or below 0.5. There's an expected value for rescaled range HE, for 1024 lookback you used, it should be around 0.54. Then you can calculate the standard error of the regression and divide it by the absolute value of HE - 0.54 (expected value) to get the Z score. Or you can just compute a confidence interval around the expected value.
+5 Ответить
QuantNomad balipour
@balipour, Thanks for your input.
I probably have to optimize code bit more for 10 > points. It can easily hit 200ms bar limit with it.
I'll continue working on it. Confidence interval can be a really nice addition. Will keep you posted with future updates.
+2 Ответить
Is there any possibility to make a video about its usage?
+1 Ответить
QuantNomad oneanalyst
@oneanalyst, I'll try to create a video about it at some point
+1 Ответить
How to use this? pls do include some guidance instruction
This publication is now featured in our Editors' Picks: https://www.tradingview.com/scripts/editors-picks/ .
In the name of all TradingViewers, thank you for your valuable contribution to the community, and congrats!
lookin good homie!
Домой Скринер акций Скринер форекс Скринер криптовалют Экономический календарь О нас Особенности Цены Приведи друга Правила поведения Справочный центр Решения для сайтов и брокеров Виджеты Графики TradingView для сайтов Легкая версия графиков Блог и новости Твиттер
Профиль Настройка профиля Счёт и оплата Ваши друзья Монеты Мои запросы в поддержку Справочный центр Личные сообщения Чат Выйти