## Sunday, February 15, 2009

### The speed of the FRAMA (Part 2): The FRASMA

Having explained my preference for a "fractalisation" of the MA to apply on a SMA(rather than on an EMA), I shall now discuss the exact form of this "fractalisation".
A modification, close to the one recommended by Ehlers, would be to merely divide the period of the SMA by the coefficient α, where α is defined as:

$\inline \alpha=exp(-4.6(D-1))\; \; \; \; \; \; \; (E\,1)$

For a dimension D varying between 1 and 2, such a division would indeed be equivalent to a change of speed in a ratio of 100, the SMA being slowed down 100 times from its initial pace, in the extreme case of a dimension of 2.
This dimension D is a numerical approximation of the Box Dimension, itself an approximation of the Hausdorff dimension of the graph, which is properly the most mathematically precise fractal dimension. There is however, another dimension that can also be seen as a Box Dimension, but of another object relating to the process under study, and that Mandelbrot called the Trail Dimension [MAN97,pp.161&172).

For a Fractional Brownian Motion, we saw earlier that:

$D_{G}=2-\alpha$

Where $D_{G}$ is what we have called so far the Fractal dimension, and α is the coefficient of the FBM (which is a different thing from the α of equation (E1)) . This latter is actually known as the Hurst-Holder exponent (or sometimes as simply the Hurst exponent, in memory of the British hydrologist whose studies of the long-term dependence of the Nile discharges, were inspirational to Mandelbrot works), and most often designed by H, I used α in reference to Falconer's book, but H seems more convenient from now on. We therefore have:

$D_{G}=2-H$

And $\inline D_{G}$ will now be known as the Graph Dimension. While the Trail Dimension will be defined as:

$\inline D_{T}=1/H$
_________________________________________________________________________________________________________________

I-Interpretation of the Trail Dimension

It is easy to see that the Trail Dimension varies between 1 and ∞, for the coefficient H varying between 1 and 0. The first question is therefore how a "dimension" growing infinitely should be understood. In [MAN97], p.161, Mandelbrot wrote the following explanation:

"First consider a Wiener Brownian motion in the plane. Its coordinates X(t) and Y(t) are independent Brownian motions. Therefore, if a 1-dimensional Brownian motion X(t) is combined with another independent 1-dimensional Brownian motion Y(t), the process X(t) becomes "embedded" into a 2-dimensional Brownian motion {X(t),Y(t)}. The value of the trail dimension:
$D_{T}=2=1/H$
is the fractal dimension of the three dimensional graph of coordinates t,X(t) and Y(t), and the projected "trail" of coordinates X(t) and Y(t). However, the dimension:
$D_{G}=2-H$
applies to the projected graphs of coordinates t and X(t) or t and Y(t)."

My understanding of the above passage, in the general case of FBM (H varying between 0 and 1, while for WBM, H=1/2), is that the Trail dimension must be seen as an approximation of the number of dimensions in which the "real" process takes place (here it might be interesting to understand the term of "dimension" in a data-mining sense, rather than in a strict topological sense, prices are clearly the end-result of many independent processes, any of them with the potential of being chaotic in their own right), under the assumption that all the coordinates of the said process can be described as independent Fractional Brownian motions sharing the same Hurst exponent.

II-Slowing down the MA with the Trail Dimension

It is now possible to conceive of a formula for the coefficient α, using the Trail Dimension. The purpose of α is to slow down the MA from a reference speed when the Hurst exponent becomes very small, and also to accelerate it when this exponent becomes close to 1. The reference speed should be taken as the one used when the price varies in a gaussian way, that is when H is 1/2. So for such a value of H, we should have α=1.
If we then consider the following formula:

$\alpha =D_{T}/2=\frac{1}{2H}\; \; \; \;\; \; \; (E2)$

For a WBM, we have α=1. In addition, for a H tending towards 0, α tends towards infinity, and for H close to 1, α=1/2.
Comparing α from (E2)(red curve) with the inverse of α from (E1)(black curve)(we take the inverse in order to get a multiplicative factor rather than a dividing one to apply on the speed of the MA), we get the following graphs:

Or, for a more detailed view of their behavior below H=1/2:

Dividing the black curve by 10 in order to have an unchanged speed for the case of a WBM, we get the following:

For H varying from 0.5 to 0, we see that the α coming from (E1) varies almost linearly, for the same variation however, we know that the randomness increases in a rather non-linear fashion; a linear slowing down of the MA does not seem to reflect this properly. From this theoretical point of view, I therefore prefer the α given by equation (E2)(not to mention that it is much more simple).

III-Implementation of the FRASMA

I programmed the FRASMA(Fractally modified Simple Moving Average) in the MetaTrader platform. You may access and download freely this indicator, as well as use it on the metatrader 4 platform, at this address of the MQL4 Community.
Please, let me know your findings or any criticisms that can improve this indicator.
Meanwhile, here is a screenshot of three fractally modified MA, the Light Blue is a version of the FRAMA from Ehlers paper (modifying a EMA), the Yellow is a modification of a SMA using the following α inspired by Ehlers paper:
$\alpha =1/(10exp(-4.6(1-H)))$
And the Red one is properly the FRASMA, using equation (E2).

Below is the fractal Graph Dimension. The period of reference for all original MA is 20.

IV-Conclusion

My purpose here is not to demonstrate that one indicator is better than another, since the quality of an indicator is relative to the manner one uses it. I believe that one must be acquainted intuitively with an indicator to use it productively, and it is for this reason that my preference is going to the FRASMA.
While one may just rely on direct practise to "understand" at an intuitive level a given indicator, I believe most of us can also profit from a theoretical understanding of them. My goal here is therefore to provide elements along these lines, for others to develop their own familiarity, and maybe provide me, in return, with some of their insights and experiences.
It is again naive to think that a trader, using technical analysis, can actually trade without some level of reliance on his intuition, and it is to totally miss the point of what the fractals tell us about the market to nourish expectations about a deterministic methodology to be successful as a trader, in other words, there is no Grail to be found in the first place. Nonetheless, to understand the technical tools one is using, can improve one's intuition, and the overall success of one's trading activity.

Anonymous said...

I really like this indicator. The good point is that we can replace the iMA with something else.

So what about a fractal adaptation of advanced digital filters. And so I did a fractal adaptation for example of the JJMA of Kositsin.

However I prefer instead of:

trail_dim=1/(2-fdi);

to use this:

trail_dim=1/(2+fdi);
or trail dim=2-fdi;

I know that you use the inverse of the H exponent. However with this
When we have a high fractal dimension it will react less, and it will react more with low fractal dimension.

t=1/2-fdi
for fdi = 1
t=1/(2-1)=1

for fdi =1,9
t=1/(2-1,9)=0.1
t= 1/0.1
t=10

So we will have exactly the opposite of what we want.

John Last

Anonymous said...

I try with

trail_dim=2-fdi; // This is the trail dimension, the inverse of the Hurst-Holder exponent
alpha=trail_dim/0.5;

However this look slower compared the original.

Jean-Philippe said...

Hi John,

Thanks for this contribution, there is nothing wrong with what you did, it is up to each and everyone to modify and to use the tools I propose as they see fit for themselves.

When I propose a new tool, I tend to propose it along my reflection, and in a certain spirit that led me in the elaboration of this given indicator, but this is not the one and only spirit that the given tool must be used, and anybody is welcome to take it away from what I imagine, and in the process to make the indicator its own.

Sorry for not replying more often to your messages, it is not that I don't find them interesting, but rather, I am busy with other matters as of now. I am indeed thinking of problems of number theory (p-adic analysis) in combination with a few philosophical ideas I sometimes discuss of in the blog, and that may well lead to a new set of very different indicators. Anyway, this is still very hypothetical, but that takes most of my time now.

Cheers

Jean-Philippe

Blogger said...

I recommend that you trade with the ultimate Forex broker.

Blogger said...

If you need your ex-girlfriend or ex-boyfriend to come crawling back to you on their knees (no matter why you broke up) you gotta watch this video
right away...

(VIDEO) Have your ex CRAWLING back to you...?