Fractal Dimensions As A Market Mode Sensor
In his article “Fractal Dimensions As A Market Mode Sensor”, John F. Ehlers has demonstrated how one can determine whether the market is in a cycle mode or trend mode.
Using Tradecision’s Indicator Builder, one needs to create the FRACTAL DIMENSION indicator:
FRACTAL DIMENSION indicator:
input
Price:"Price",MedianPrice();
N:"N must be an even number",30;
end_input
var
Smooth:=0;
count:=0;
N1:=0;
N2:=0;
N3:=0;
HH:=0;
LL:=0;
Ratio:=0;
Dimen:=0;
end_var
if HistorySize < 3 then return 0;
Smooth:=(Price + 2 * Price\1\ + 2 * Price\2\ +
Price\3\) / 6;
N3:=(Highest(Smooth, N) - Lowest(Smooth, N)) / N;
HH:=Smooth;
LL:=Smooth;
for count:=0 to N / 2 - 1 do begin
if Smooth\count\ >HH then
HH:=Smooth\count\;
if Smooth\count\ < LL then
LL:=Smooth\count\;
end;
N1:=(HH - LL) / (N / 2);
HH:=Smooth\N / 2\;
LL:=Smooth\N / 2\;
for count:=N / 2 to N - 1 do begin
if Smooth\count\ >HH then
HH:=Smooth\count\;
if Smooth\count\ < LL then
LL:=Smooth\count\;
end;
N2:=(HH - LL) / (N / 2);
if N1 >0 and N2 >0 and N3 >0 then
Ratio:=0.5 * ((LogN(N1 + N2) - LogN(N3)) /
LogN(2) + Dimen\1\);
Dimen:=SMA(Ratio, 20);
return Dimen;
|
Download to import into Tradecision. 
How to use this indicator in Tradecision:
- Click Download.
- Save this indicator in a safe location on your hard drive.
- Open Tradecision and in the Tools menu click Indicator Builder.
- In the Indicator Builder dialog, click Import, locate the saved file and then click OK.
The indicator will be added to the Custom Indicators list.
|