All John Ehlers Indicators... - page 66

Lloyd_au
16
Lloyd_au  

There is also the choppiness index by Dreiss (an Aussie!) which makes sense. I use my more elaborate (smoothed, and some tweaks which I may share when I have cleaned up my messy coding) version of this to create adaptive indicators. I copy this from a Ward Systems site. From memory this may be upside down or something, I had to fix it and added some things.

There are possibly easier to understand languages upon a little googling.

HMax = MaxList(Max(High, Close[1]), Period)

LMax = MinList(Min(Low, Close[1]), Period)

Choppiness = 100.0 * Log(Sum(TrueRange,Period)/(HMax -LMax)) / Log(Period)

where:

Close[1] is Close one bar ago,

Max(a,b) is the largest of a and b,

MaxList(a,N) is the largest a in N bars back,

MinList(a,N) is the smallest a in N bars back,

Sum(a,N) is the sum of a over N bars back,

TrueRange is True Range.

Lloyd_au
16
Lloyd_au  
mladen:
Just my 5 cents :

Carlos Sevcik's fractal dimension calculation was published first time here : A procedure to Estimate the Fractal Dimension of Waveforms

He published a code written using basic there that was supposed to calculate the FDI. The problem with it was (and still is) that it will almost never go bellow 1.5 (the value that is important as a kind of a boundary between the trending - bellow 1.5 - and random - values above 1.5 - estimation). After that, I gave up that approach.

There is a version made by Alex Matulich (here : http://unicorn.us.com/trading/src/_FractalDim.txt ) that corrects some errors made by Sevcik. Also, there is another fractal dimension calculation made by Mark Jurik (he made it before he made the composite fractal behavior) which has nothing in common with either Sevcik's way or Matulich's way of calculating it and is more a kind of a curiosity than anything else

_________________

Now, one more thing.

Once I found a german paper with a proof that fractal dimension index can not be applied to financial markets. Unfortunately I haven't bookmarked the link and after that I was never able to find that paper again. If I ever find it again will post a link to it, but I though that all should know that there such opinions of fractal dimension index too

My coding produces values that go above and below 1.5. I have mentioned an academic critique, which confirmed my analysis in excel (where I can plop in values where things "ought" to result in a number - that it does have its limitations as to values - I think it cannot get below about 1.25 from memory. I think it may have an upper bound of maybe 1.9, again from memory. I can cope with that.

By this method I also found Ehlers FRAMA a bit TOO incorrect.

As to the german critique, I am guessing it could be two things - that if there is a spike, this pretty much makes all values for the period thereafter silly until that spike is eliminated from the calculations. An example is when the Yen rallied a lot in just a couple days sometime last year or whenever, and then went mostly back to normal - the FDI gave stupid results until that rally was eliminated.

The other reason may be that a market will have vastly different FDIs depending on the time frame - they are essentially different markets - you might be short in one timeframe and long in another. Or, one timeframe may be trending and another random. But isn't this true of many indicators at times?

Mladen Rakic
201590
Mladen Rakic  
Lloyd_au:
My coding produces values that go above and below 1.5. I have mentioned an academic critique, which confirmed my analysis in excel (where I can plop in values where things "ought" to result in a number - that it does have its limitations as to values - I think it cannot get below about 1.25 from memory. I think it may have an upper bound of maybe 1.9, again from memory. I can cope with that.

By this method I also found Ehlers FRAMA a bit TOO incorrect.

As to the german critique, I am guessing it could be two things - that if there is a spike, this pretty much makes all values for the period thereafter silly until that spike is eliminated from the calculations. An example is when the Yen rallied a lot in just a couple days sometime last year or whenever, and then went mostly flat.

The other reason may be that a market will have vastly different FDIs depending on the time frame - they are essentially different markets - you might be short in one timeframe and long in another. Or, one timeframe may be trending and another random. But isn't this true of many indicators at times?

Lloyd_au

If you take original Carlos Sevcik's basic code from that page the cases when it goes bellow 1.5 can be counted on one hands fingers. Alex Matulich's way produces correct results. My problem with that is that the code from Sevcik's page was not tested before published and it took some time for some people to find where the errors are. That is not what we should expect from a serious publication (but then, hey, Mark Jurik published something that he called Jurik TPO and it turned out to be Spearman rank auto-correlation and then he quickly removed all the mentioning of that unfortunate TPO)

I was not talking about other ways of calculating FDI

_______________

As of German paper : it was not a critique, but a mathematical proof that FDI can not be used in financial markets. But untill I re-find that link, let us leave that part as a hypothetical for now (otherwise it would become just a rumor or a gossip) . All I wanted to do is to point out that there are disagreements of FDI usability in financial markets (and financial time series ultimately)

Lloyd_au
16
Lloyd_au  
mladen:

There is a version made by Alex Matulich (here : http://unicorn.us.com/trading/src/_FractalDim.txt ) that corrects some errors made by Sevcik. Also, there is another fractal dimension calculation made by Mark Jurik (he made it before he made the composite fractal behavior) which has nothing in common with either Sevcik's way or Matulich's way of calculating it and is more a kind of a curiosity than anything else

I think Matulich is wrong when he says "Because the lookback length n goes from 0 to n, we also have nintervals, and not n-1 intervals as described in the paper."Let's say to are building a fence, and you have just three fence posts for this wonderful fence that many will admire. You need to put a gate between each of them. How many gates do you need?

Mladen Rakic
201590
Mladen Rakic  
Lloyd_au:
I think Matulich is wrong when he says "Because the lookback length n goes from 0 to n, we also have nintervals, and not n-1 intervals as described in the paper."Let's say to are building a fence, and you have just three fence posts for this wonderful fence that many will admire. You need to put a gate between each of them. How many gates do you need?

That is not how fdi is calculated (and as far as I see you know it)

The basic idea is to go over a sample of data over and over extending the calculation length further and further and that way extending the sample used in the calculation. There is no room for "doors"

Lloyd_au
16
Lloyd_au  
mladen:
Lloyd_au

If you take original Carlos Sevcik's basic code from that page the cases when it goes bellow 1.5 can be counted on one hands fingers. Alex Matulich's way produces correct results. My problem with that is that the code from Sevcik's page was not tested before published and it took some time for some people to find where the errors are. That is not what we should expect from a serious publication (but then, hey, Mark Jurik published something that he called Jurik TPO and it turned out to be Spearman rank auto-correlation and then he quickly removed all the mentioning of that unfortunate TPO)

Yes, I looked at his original code and I scratched my head for a few weeks until I stumbled across others who had coded it in a manner I could cope with.

pd:=whatever you like;

x:=C; (only because I played with what I wanted x to be)

r:=HHV(H,pd)-LLV(L,pd);

a1:=Sqrt(Pwr((Ref(x,-0)-Ref(x,-1))/r,2)+1/Pwr(pd,2));

a2:=Sqrt(Pwr((Ref(x,-1)-Ref(x,-2))/r,2)+1/Pwr(pd,2));

.

.etc for the number periods specified - some clever people may have a sub routine.

Then

FDI:=1+(Log(a1+a2+up to a"pd")+Log(2))/Log(2*(pd-1));

It works.

Yes, it is a far from perfect measure of FDI, but there you go. I have said what I think about FRAMA.

Anyway. There is my metastock code.

wintersky111
355
wintersky111  
Lloyd_au:
I hope that Jean-Philipe's FGDI works for you and others. It is one of the first things I consider. It is quite robust, and even takes into consideration the box counting issue You are correct about the Hurst exponent. For trading purposes it is useless, in my opinion. It is a number which was designed to attempt to define an entire time series array - the more data the better. Not just the last 32 days or so. Well, that is what I think.

Frankly, box-counting isnt any robust at all. The formula tells you as much. The error terms in this file below was for a strict gaussian distribution time series. One can only imagine ow much robustness there is when the series varies away from Gaussian occasionally.

http://arxiv.org/pdf/1101.1444.pdf

The idea of Rescaled Range Analysis was excellent in itself, but the amount of data needed for Hurst Exponent calculation as stated in some papers to range from afew thousand to tens of thousands.

Wintersky

wintersky111
355
wintersky111  
Lloyd_au:
From the description at Elite forum supplied site, Variance ratio is pretty identical in principle to the basic formula for measuring the fractal dimension, except that it uses what seems to be the standard deviation or variance (?).. Is it an F-test?

The Variance Ratio sounds like a very raw/noisy form to me if the formula is as stated in the link there. The bad thing here is that it divides the longer time ratio by the shorter time ratio. The least that could be done there is to observe Einstein's Square Root rule for random particles. As a whole, the idea seems to be using variance comparison as a base for comparing volatility.

Wintersky

nevar
455
nevar  

This is the modified version of FDI Free download of the 'Variation Index' indicator by 'Ilnur' for MetaTrader 4 in the MQL5 Code Base has anyone seen it?I find it useful.

Lloyd_au
16
Lloyd_au  
nevar:
This is the modified version of FDI Free download of the 'Variation Index' indicator by 'Ilnur' for MetaTrader 4 in the MQL5 Code Base has anyone seen it?I find it useful.

That is pretty cool, thanks for that. Having just spent some time comparing it to FGDI, they are not too dissimilar, I think the VI is a bit more conservative - it calls a market flat before FGDI, but this varies.. I fail to understand the code - it seems that there is an iterative procedure.