Jason
I know you have looked at this at least once before and couldn't make it work but I was wondeing if you would consider taking a second look. Below is the TS ELD code which does seem to work and I thought it might be of some assistance.
Let me know what you think.
Regards
Doug
{ ************ Program to Calculate Fractal Dimension of Waveforms
Based on code by Carlos Sevcik,
"A procedure to Estimate the Fractal Dimension of Waveforms",
target="_blank">http://unicorn.us.com/</a> }
Inputs:
N ( 30 ) ;
variables:
Diff( 0 ),
Length( 0 ),
PriceMax ( 0 ),
PriceMin( 0 ),
PriorDiff( 0 ),
Iteration( 0 ),
FractalDim( 0 ) ;
PriceMax = Highest( Close , N ) ;
PriceMin = Lowest( Close, N ) ;
Length = 0 ;
PriorDiff = 0 ;
for Iteration = 1 TO N -1
begin
if (PriceMax - PriceMin) > 0 then
begin
Diff = (Close[Iteration] - PriceMin) / (PriceMax - PriceMin) ;
if (Iteration> 1) then
begin
Length = Length + SquareRoot( Square(Diff - PriorDiff) + (1 / Square(N)) ) ;
end ;
PriorDiff = Diff ;
end ;
end ;
if Length > 0 then
FractalDim = 1 + ( LOG( Length )+ LOG( 2 ) ) / LOG( 2 * ( N ) )
else
FractalDim = 0 ;
Plot1( FractalDim ) ;
I know you have looked at this at least once before and couldn't make it work but I was wondeing if you would consider taking a second look. Below is the TS ELD code which does seem to work and I thought it might be of some assistance.
Let me know what you think.
Regards
Doug
{ ************ Program to Calculate Fractal Dimension of Waveforms
Based on code by Carlos Sevcik,
"A procedure to Estimate the Fractal Dimension of Waveforms",
target="_blank">http://unicorn.us.com/</a> }
Inputs:
N ( 30 ) ;
variables:
Diff( 0 ),
Length( 0 ),
PriceMax ( 0 ),
PriceMin( 0 ),
PriorDiff( 0 ),
Iteration( 0 ),
FractalDim( 0 ) ;
PriceMax = Highest( Close , N ) ;
PriceMin = Lowest( Close, N ) ;
Length = 0 ;
PriorDiff = 0 ;
for Iteration = 1 TO N -1
begin
if (PriceMax - PriceMin) > 0 then
begin
Diff = (Close[Iteration] - PriceMin) / (PriceMax - PriceMin) ;
if (Iteration> 1) then
begin
Length = Length + SquareRoot( Square(Diff - PriorDiff) + (1 / Square(N)) ) ;
end ;
PriorDiff = Diff ;
end ;
end ;
if Length > 0 then
FractalDim = 1 + ( LOG( Length )+ LOG( 2 ) ) / LOG( 2 * ( N ) )
else
FractalDim = 0 ;
Plot1( FractalDim ) ;
Comment