PureBytes Links Trading Reference Links ```I did not write that, I just posted the link to Bob Fulks' code in the purebytes archive: http://www.purebytes.com/archives/omega/2001/msg02938.html ----- Original Message ----- From: "Alex Matulich" To: "ROBERT L ROPER" Cc: Sent: Thursday, January 17, 2002 3:01 PM Subject: Re: EL code for H ? > Robert L Roper wrote: > >> Is anybody willing to share his Easy Language (EL) code for calculation > >> of Hurst Exponent (H) ? > > The relation between the Hurst exponent and the fractal dimension is > simply D=2-H, where D is the fractal dimension and H is the Hurst > exponent. > > I have a method for calculating D, so you can easily get H=2-D from > that. This is a VBA macro function, but it should be trivial to > port it to EasyLanguage. I abandoned it a while ago so I never > bothered, but I might do it if I have the time. > > I got the algorithm from a technical paper at > http://www.csu.edu.au/ci/vol05/sevcik/sevcik.html if you're > interested in reading up on it. -Alex > > > ' ************ Program to Calculate Fractal Dimension of Waveforms > ' > 'See the following article: > 'http://www.csu.edu.au/ci/vol05/sevcik/sevcik.html > '"A procedure to Estimate the Fractal Dimension of Waveforms" > ' by Carlos Sevcik > ' Laboratory on Cellular Neuropharmacology > ' Centro de Biofsica y Bioqumica > ' Instituto Venezolano de Investigaciones Cientficas (IVIC) > ' Apartado 21827, Caracas 1020A > ' Venezuela. > ' Email: csevcik@ ivic.ivic.ve > ' > 'Arguments: > ' xx = Excel range of x values dimension (1 to n, 1 to 1) > ' (the X values would be bar numbers or dates) > ' yy = Excel range of y values dimension (1 to n, 1 to 1) (e.g. prices) > 'Returns: fractal dimension of the time series > > Function fractaldim(xx As Variant, yy As Variant) As Double > > Dim n As Integer, i As Integer, lngth As Double, x As Variant, y As Variant > Dim ymax As Double, ymin As Double, xmax As Double, xmin As Double > Dim xscl As Double, yscl As Double > Dim yt As Double, xt As Double, yl As Double, xl As Double > Dim xd As Double, yd As Double > > x = xx.Value 'convert Excel range to array > y = yy.Value > n = UBound(x, 1) > xmin = Application.WorksheetFunction.Min(x) > xmax = Application.WorksheetFunction.Max(x) > xscl = xmax - xmin > ymin = Application.WorksheetFunction.Min(y) > ymax = Application.WorksheetFunction.Max(y) > yscl = ymax - ymin > If n < 2 Or ymax = ymin Or xmax = xmin Then > fractaldim = 1 > Exit Function > End If > > ' *** calculate length of curve *** > lngth = 0# > yl = (y(1, 1) - ymin) / yscl > xl = (x(1, 1) - xmin) / xscl > For i = 2 To n > yt = (y(i, 1) - ymin) / yscl > xt = (x(i, 1) - xmin) / xscl > If i > 1 Then > xd = xt - xl: yd = yt - yl > lngth = lngth + Sqr(xd * xt + yd * yd) > End If > xl = xt: yl = yt > Next > > fractaldim = 1 + Log(lngth) / Log(2# * (n - 1)) 'Log()=natural log > End Function > ```