Login Page - Create Account

Support Board


Date/Time: Fri, 01 Nov 2024 02:20:46 +0000



Hurst exponent study?

View Count: 2525

[2017-02-17 21:42:50]
User71961 - Posts: 144
Is there a study in SC that displays the running estimated Hurst Exponent? (its kind of like RSI...but a little more complicated)

Here is Python code to create the Hurst Exponent for the last value of a TimeSeries ts.
If SC could call this function iteratively (including options for how many data points are in the rolling TimeSeries ts), then SC could output a study which shows the Hurst Exponent as it develops over time for any time series.



from numpy import cumsum, log, polyfit, sqrt, std, subtract

def hurst(ts):
  # Returns the Hurst Exponent of the time series vector ts

  # Create the range of lag values
  lags = range(2, 100)

  # Calculate the array of the variances of the lagged differences
  tau = [sqrt(std(subtract(ts[lag:], ts[:-lag]))) for lag in lags]

  # Use a linear fit to estimate the Hurst Exponent
  poly = polyfit(log(lags), log(tau), 1)

  # Return the Hurst exponent from the polyfit output
  return poly[0]*2.0



If such a study does not exist, could it be added to SC?
I suspect a lot of people would love to be able to see this study at the bottom of our charts...
Date Time Of Last Edit: 2017-02-17 22:36:02
[2017-02-17 23:08:49]
Sierra Chart Engineering - Posts: 104368
The formula is not clear for us.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
[2017-02-17 23:48:43]
User71961 - Posts: 144
tau = is just 3 nested array functions (square root, standard deviation, subtract) with a "for lag in lags" loop to iterate over each item in the arrays
"lag" is just a counter variable (similar to using "i") to iterate over the lags array

polyfit is a regression function, similar to the Slope function in excel

all of these functions are part of the python standard numpy library, which is freely available
Date Time Of Last Edit: 2017-02-18 01:48:21
[2017-02-18 01:03:30]
User71961 - Posts: 144
i guess i should ask....exactly which part of the python code is not clear?
[2017-02-18 22:59:26]
User71961 - Posts: 144
if it helps, here is a webpage discussing calcing the Hurst Exponent

http://www.bearcave.com/misl/misl_tech/wavelets/hurst/
[2017-03-11 22:32:55]
Sierra Chart Engineering - Posts: 104368
Hurst Exponent has been implemented in 1528. It performs a cumulative calculation since the first bar in the chart. It extremely efficient. You can see the calculation time in milliseconds after the end of the study name in the Studies to Graph list on the Chart Studies window.

It is not moving like a Moving Average but we could implement that.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
Date Time Of Last Edit: 2017-03-11 22:35:20
[2017-05-22 20:51:17]
Sierra Chart Engineering - Posts: 104368
We have completed the development of the Hurst Exponent study. It took a long time because there were many variations of it available. We did some research and this is the one we finally decided on:
https://en.wikipedia.org/wiki/Hurst_exponent

This implementation executes very fast.

We are preparing detailed documentation for it in the Technical Studies Reference and that should be out in the next day or two. The study is available in the latest revision in version 1559.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account