Tuesday, July 8, 2008

Comments on some existing fractal-related tools

A few indicators, that relate to fractals (or seem to do so) are already easily available on several platform.

The first, maybe the simplest is called "Fractals", and when you use it, it draws little arrows, some pointing up, others pointing down, like this:


This indicator, however, has nothing to do with fractals, it relates to Elliot Wave Theory, as explained here: http://trading-stocks.netfirms.com/fractals.htm

A derivation of this is called the "fractal channel" which links the little arrows, similarly, it has nothing to do with fractals.

More relevant then is the Fractal Adaptive Moving Average, which relates to Kaufman's AMA, but uses fractal theory to determine the current volatility of the market in order to adjust the speed of the MA. The idea of the AMA is to slow down the MA when the market is moving sideways, and to speed it up when there is a trend. To achieve this objective, John Ehlers developped the FRAMA, using the Fractal Dimension as a direct measurement of Volatility, he explains his method in a file (title: FRAMA) that can be downloaded from this address: http://www.mesasoftware.com/technicalpapers.htm

On the following graph, I plotted a simple 16-MA (blue), an exponential 16-MA (yellow) and the FRAMA in red (with a reference period of 16 as well). Below are the fractal dimension used by the FRAMA (and computed from the formula of the above paper), as well as a more sophisticated fractal dimension (to which I will come later):
Clearly, during the sideways market (until about 16:45), the FRAMA is somewhat smoothier than the two others, and when the trend goes on, it also reacts faster. Therefore, we can say that the FRAMA is a good AMA. However, it could be better, the computation of the fractal dimension is rough to say the least, it oscillates between extreme values (from 2 to below 1) that don't even make sense mathematically. The FDI plotted in the lowest window, displays a more reasonable fractal dimension (the period to calculate both is 16), for those interested in this tool, I would therefore advise to use the FDI and that might entail a modification in the factor -4.6 in the computation of the coefficient alpha (from the FRAMA paper) where Ehlers recommends:

\alpha=\exp(-4.6(D-1))

The fractal dimension Df in the FDI follows the following formula:


Where N is the number of periods(price valuations) considered. Df provides us with some idea of volatility, when Df gets close to 2, it means that we have very high volatility, the closer to 1 and we have low volatility or, in other terms, a well-defined trend. But that's very general qualitative comments, the passage to a computable quantity is trickier. Elhers assumes that price movements are following a lognormal distribution (which is not the case) and, on this basis, comes to compute the value of alpha as an exponential. I will, in the near future, share my reflections on how to get an identified numerical measure of entropy (volatility) from Df.

But for now, my point is merely to say that the fractal dimension is an indicator of volatility, it does not inform on the direction of the market. To get this direction, many analysts rely on MA or combination of them (such as Ichimoku, Bands,...), those indicators may be refined, using the fractal theory, but they then become hybrid indicators, mixing two diverging conceptions of what price movement is about.

As of now, and as far as I know, the only technical tool fractal theory is providing is a measure of volatility, but volatility in itself may be an interesting information to set up one's stop and position size. It may not be necessary to use volatility as a mere entry variable into another indicator.

15 comments:

Anonymous said...

I've just recently bought Mt4 Protect and wanted to tell you guys about my experience with it.
I was worried about all the MT4 Trojan Horse's out there at the moment as I heard you can get them from downloading EA's from the internet.
While I don't download decompiled forex robots the last thing I want is some hacker getting my account details and draining my trading account as I have built it up into quite a bit of cash. That's why I purchased MT4 protect so it can stop my account from getting attacked. I think the price is well worth the protection I will receive
I got a copy at [url=http://www.mt4protect.com/] http://www.mt4protect.com/ [/url] via paypal and my product code was sent to me within 4 hours.
I installed it and its wicked! It works in the system tray and scans my computer in real time to detect any attacks.
The EA optimization tool is so great - you can allocate more memory to your MT4 terminal so your trades get executed faster! There are also heaps of registry tweaks and cleanup features that have speeded up my Windows XP computer.
With malware and virus attacks hitting Forex traders all the time now I definitely think that MT4 Protect is a worthwhile investment.

Cool said...

Hi, any ideas on how to arrive at a eqn for alpha using the second measure of FDI in your post? Would like to see if using this second measure results in an improvement in Ehler's FRAMA.

Thanks for your enlightening blog.

Jean-Philippe said...

Hi Cool,

I updated one post to address your concern, where I compared Elhers FRAMA using the 2 different ways of calculating the Fractal Dimension, you can see the results here:
http://fractalfinance.blogspot.com/2009/01/speed-of-frama-1.html

MusX said...

Hi Jean-Philippe

I'm trying to implement your ideas on opensource R platform. I read both the latex D definition and the mql4 code.
At the beginning I wanted to point there is no definition of pricerange anywhere near the latex. From mql4 I see it's max over period minus min over period.
The next thing is: close(i)-close(i-1). Your code from mql4 is quite different than latex. I understand the programming language force some implementation, but still cannot fully understand the connection between your latex and mql4.
diff = (inputData[pos + iteration] - priceMin )/pricerange
why there is priceMin in the nominator?

If we want to split fraction to diff and priorDiff to do not calculate diff but use it from the previous iteration. Shouldn't we have something kind of:
diff = close(i)/pricerange
length += sqrt(...
priorDiff = diff

If you have anything more from documentation I would be very happy to see if possible.
Thanks
Jan

MusX said...

Another thing is that iteration:

for( iteration=0; iteration <= g_period_minus_1; iteration++ )
{
if(( priceMax - priceMin)> 0.0 )

whole body of iteration is inside the 'if' to do not divide by 0, by why the if isn't before the for loop? priceMax and priceMin are not changing during the loop execution, right? shouldn't this 'if' be before 'for' loop? There are two loops like this.

Jean-Philippe said...

Hi Jan,

Thanks for your contribution. first of all, I am not the original author of the code you are discussing, I mention that somewhere else in the blog.
As for your questions, you can check the following post: http://fractalfinance.blogspot.sg/2009/04/fractal-dimensionsand-fractal-graph.html
where I provide the link to the original code by iliko, and also modify this code to slightly correct it and add some other features. This code and the modifications come from an article on the net that explains the method used and, I believe, should answer your questions, you can find this article at this address: http://www.complexity.org.au/ci/vol05/sevcik/sevcik.html

Let me know if you need further clarifications.

As for your last remark though, about the "if" and the "for", you're right, it would be better on an algorithmic point of view to have the "if" outside the "for", I did not notice it when correcting iliko's code.

MusX said...

Thanks for the information.
I would like to make both sides frasma, do you have some tips for such task? :)
Have you heard about bitcoin? much new people will get to your blog because of this service.

Jean-Philippe said...

I am not sure what you mean by "make both sides FRASMA"? Can you explain? Which "both sides"?

No, I did not know about bitcoin, and I don't see how it is related to my blog, can you give me more detail about that?

MusX said...

Both sides frasma, I mean to count periods in both ways, from last n periods and next n periods.
Like this: http://rss.acs.unt.edu/Rdoc/library/zoo/html/rollmean.html rollmean(align = 'center').
Bitcoin is a financial tool which gives you access to cheapers and simplest stock market.

Guilherme G. Rafare said...

Dear Jean-Philippe,

First of all, I congratulate you for the quality of your posts.

I have read Ehlers paper on FRAMA and I am still trying to find out how did he come out with the constant -4.6, perhaps you could comment on that.

Best,

Guilherme

Jean-Philippe said...

Hi Guilherme,

You're right, Elhers does not provide any explanation for his constant. I don't really know where it comes from, but maybe, we can guess it is the result of trials and errors.

Cheers

Jean-Philippe

Guillermo Ruiz said...

-4.6 is the rounded coefficient for a period of 200. This is Log(2/(200+1)) = -4.6101577

You can change the slowest period with this formula.
Log(2/(period+1))

Blogger said...

eToro is the ultimate forex broker for rookie and established traders.

Blogger said...

If you'd like an alternative to casually approaching girls and trying to find out the right thing to say...

If you would rather have women pick YOU, instead of spending your nights prowling around in crowded bars and nightclubs...

Then I encourage you to watch this short video to uncover a strong secret that has the power to get you your very own harem of beautiful women:

FACEBOOK SEDUCTION SYSTEM...

Blogger said...

QUANTUM BINARY SIGNALS

Professional trading signals delivered to your mobile phone every day.

Follow our trades right now and profit up to 270% daily.