Monday, May 17, 2010

Variation of the Hurst Exponent

While playing around with various strategies, I came to consider that an interesting way to use the fractal dimension is to look at its variations rather than its absolute value. Furthermore such an approach makes sense at a mathematical point of view: from equation (1) in this post, applying the functional power rule of derivation, we can see that:

Rearranging it, we get:

Asymptotically (for t sufficiently high), we can then see that the sign of the variation of H with time gives us the sign of the variation of the variance over time, and when this variation is positive, it indicates an increasing volatility and is therefore the best time to enter a trade. It must be noted that this indication does not say anything about the sense of the trade we should enter, and it therefore ought to be combined with a directional indicator in order to be fully operational.

Even though most of such variations can be seen by just looking at the FGDI graphic, it is just as easy (and possibly adding some precision) to program a new indicator that displays the variations of H over time, the script of this indicator can be found here on MQL4.
Below the indicator Hurst_Difference is displayed in the lower window on a 1hr chart for EUR/USD:

Whenever this indicator display a value above 0, it indicates a potential entry for a trade.
The parameters of Hurst_Difference.mq4 are:
f_period (integer): This is the period considered for calculating the fractal dimension, default is 30.
type_data (0,1,2,3,4,5 or 6): This is the type of price the indicator will consider (0=CLOSE, 1=OPEN, 2=HIGH, 3=LOW, 4=MEDIAN, 5=TYPICAL, 6=WEIGHTED), default is 0.


martin said...

could you try to imitate the iMAOnArray mql4 function for calculating the moving average by frasma method if you have time and energy? thank you

Jean-Philippe said...

Hi Martin,

Not completely sure what you are asking.
Do you want me to make the FRASMA such as it applies on any numeric array instead of just a few price series (CLOSE, OPEN,...)?

Anonymous said...

I think that he means that by this function you can create
fractalysed slow stochastic,
fractalysed slow CCI
fractalysed slow RSI
anything using the formula output and having a fractalysed moving average of this function. And the crossing would be the signal. In theory that could create better lagging indicators.

Jean-Philippe said...

If so, there is just a few lines to change in the code. It's just a matter of adding the code of the desired indicator as a subroutine and replacing the iMA line to update the external buffer.
One may also have to modify the separate_window order at the beginning of the code.

Mohit agrawal said...

Hey Jean, I really appreciate your work.Great stuff!Just that I'm a bit lost on that equation concerning the variation of variance. Could you please tell me where to look for a theoretical proof for that equation. Im a student and working on a project that's why I needed it.
Thanks in advance.

Jean-Philippe said...

Hi Mohit, Yes, you are right, I've been less than rigorous in my derivation, and my previous equivalence was unwarranted. I corrected it using the classical derivation rules for a power of function and I hope my conclusions still remain valid. Thank you for pointing out this error.

Unknown said...

Hi JP,
Thanks for sharing the indicator.
I've been using it with a new EA that I've built, and I've got it working great in strategy tester, but when I put it on to trade live, for some reason the hurst difference suddenly takes a big downward spike - any idea why this would be?

Blogger said...

I would like to advise that you pick the #1 Forex broker.

forex live alerts said...

forex live alerts