[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: FRACTALS - Relevancy to Technical Analysis?



PureBytes Links

Trading Reference Links

I wanted to add one more thing:

My fractal dimension calculation in EasyLanguage is at
http://unicorn.us.com/trading/src/_FractalDim.txt and reproduced below.
It's an approximation, but a pretty good and efficient one, as you will
see if you slog through the article from where I got the algorithm.

--------------------------------------------------------------------
{_FractalDim
 Calculate the approximate Fractal Dimension of a waveform
 Copyright (c) 2003 by Alex Matulich, Unicorn Research Corporation

 Note: the Hurst exponent H = 2 - D, where D is the fractal dimension.

 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 Biofísica y Bioquímica
       Instituto Venezolano de Investigaciones Científicas (IVIC)
       Apartado 21827, Caracas 1020A
       Venezuela.
}

Inputs:
    y(NumericSeries),	{price data, e.g. Close of data1}
    n(NumericSimple);	{lookback length}

Vars: j(0), lngth(0), ymax(0), ymin(0), yscl(0), dx2(0), dy(0);

ymin = Lowest(y, n); ymax = Highest(y, n); yscl = ymax - ymin;
if n < 2 Or ymax = ymin Or n = 1 then
    lngth = 1
else begin
    { calculate length of curve }
    lngth = 0;
    dx2 = Square(1/(n-1));
    for j = 1 To n-1 begin
        dy = (y[j] - y[j-1]) / yscl;
        lngth = lngth + SquareRoot(dx2 + dy*dy);
    end;
end;
_FractalDim = 1 + Log(lngth) / Log(2*(n-1));
--------------------------------------------------------------------

-Alex