Indicators: FRASMA: Fractally Modified Simple Moving Average - page 2

 
MadCow:
funyoo:

Thanks for these indicators. I have tried to code an expert advisor based on the fractal dimension.


jppoton

I read your blog, and it convinced me that your use of Fractal dimension is better than Ehlers. Good work, and thanks for the excellent explanation.

On funyoo's site he states that there is a problem with the indicator. The EA he has made works pretty well on the strategy tester, but that's not much proof. Someone there suggested that 'fractal dimension.mq4' may be repainting. The indicator seems to change color one bar before it crosses the threshold, but not in all cases, as if it occasionally gets a peek into the future. Please comment on this.



Hi MadCow,

Thanks for your appreciation.

I just replied to Funyoo in his thread on Trading System FOREX. As I said there, I don't think FDI repaints anything, simply the "curve" of FDI is just linking points of a discrete set, and the color is determined by the end point of the segment drawn, it may then be the case that the starting point of a segment is above 1.5, and the end point is below, in which case the segment will be red (or blue in teh opposite case of a starting point below 1.5 and end point above it).

Hope this clarifies, and that I understood correctly your concern.

JP

 
jppoton:
MadCow:
funyoo:

Thanks for these indicators. I have tried to code an expert advisor based on the fractal dimension.


jppoton

I read your blog, and it convinced me that your use of Fractal dimension is better than Ehlers. Good work, and thanks for the excellent explanation.

On funyoo's site he states that there is a problem with the indicator. The EA he has made works pretty well on the strategy tester, but that's not much proof. Someone there suggested that 'fractal dimension.mq4' may be repainting. The indicator seems to change color one bar before it crosses the threshold, but not in all cases, as if it occasionally gets a peek into the future. Please comment on this.



Hi MadCow,

Thanks for your appreciation.

I just replied to Funyoo in his thread on Trading System FOREX. As I said there, I don't think FDI repaints anything, simply the "curve" of FDI is just linking points of a discrete set, and the color is determined by the end point of the segment drawn, it may then be the case that the starting point of a segment is above 1.5, and the end point is below, in which case the segment will be red (or blue in teh opposite case of a starting point below 1.5 and end point above it).

Hope this clarifies, and that I understood correctly your concern.

JP


JP,


That's clear, but I think I misstated the problem. The problem is with the fractal dimension indicator, not the FRASMA. If you consider the current bar as it paints, you don't really know whether the point will be above or below the threshold until the bar has completed. Only then do you correctly know the color of the segment. This is not really a problem if you try to make an EA of the indicator, because you can simply wait for the bar to complete before making a decision, or using the result.



However most EA's don't wait for the bar, but make decisions with each tick, and the color of the segment may change after the decision was made, so if you try to look at the history of the trades the EA makes, the color segments will paint before they are known to the EA, and it will be hard to understand what happened. No real problem, just nitpicking really. I truly like the FRASMA, it is better than the FRAMA. It is interesting that if one adjusts the parameters, the FRASMA will overlay Ehlers Adaptive Laguerre Filter very closely.



MadCow

 

Hi Jean-Philippe,

I hope you're doing well.

I've downloaded FRASMA and find it fascinating, but I'm not a very mathematical person. I spent quite a long time reading your blog and I must say I'm more confused now than before I went :)

I understood clearly your explanation of using SMA over EMA which would seem to make perfect sense, if indeed you are an intra-day trader as I am.

What I wasn't clear on, and could not find a clear understanding of on your blog are the settings to use when replacing a current SMA/EMA with FRASMA.

I assume that e_period and e_type_data would be the Period: and Apply to: settings of the current moving average that you're replacing, but I have no idea what the normal_speed setting should be, or how I should calculate it.

For instance, I am currently using a 50 period, weighted EMA which I would like to replace with a 50 Period FRASMA.

Since it's not possible to utilize a weighted close, (FRASMA does not allow e_type_data > 3), how would I set this up, and most importantly for future reference, how does one calculate the normal_speed of a FRASMA?

Thank you so much for your hard work and your great contribution to the community :)

Tai

 
tsheppard:

Hi Jean-Philippe,

I hope you're doing well.

I've downloaded FRASMA and find it fascinating, but I'm not a very mathematical person. I spent quite a long time reading your blog and I must say I'm more confused now than before I went :)

I understood clearly your explanation of using SMA over EMA which would seem to make perfect sense, if indeed you are an intra-day trader as I am.

What I wasn't clear on, and could not find a clear understanding of on your blog are the settings to use when replacing a current SMA/EMA with FRASMA.

I assume that e_period and e_type_data would be the Period: and Apply to: settings of the current moving average that you're replacing, but I have no idea what the normal_speed setting should be, or how I should calculate it.

For instance, I am currently using a 50 period, weighted EMA which I would like to replace with a 50 Period FRASMA.

Since it's not possible to utilize a weighted close, (FRASMA does not allow e_type_data > 3), how would I set this up, and most importantly for future reference, how does one calculate the normal_speed of a FRASMA?

Thank you so much for your hard work and your great contribution to the community :)

Tai

Hi Tai,

Thanks for your interesting comments.

As for your questions, the e_period is not directly used in relation with the FRASMA, but rather is the number of bars used to calculate the Fractal Graph Dimension, fdi in the program, via the line:

fdi=1.0 +(MathLog( length)+ LOG_2 )/MathLog( 2 * e_period );

This fdi is then, in turn used to calculate the Trail dimension:

trail_dim=1/(2-fdi);

Then the alpha is half of this Trail dimension, and this alpha is then used to calculate the resulting fractalised speed of the FRASMA which really is an SMA with a variable fractalised speed:

speed=MathRound(normal_speed*alpha);
ExtOutputBuffer[pos]=iMA(NULL,0,speed,0,0,0,pos);


As for the normal_speed, it really is the speed you want the SMA to be in when there is no need to fractalise it, it therefore is the speed of your SMA before it becomes the FRASMA, which in your case, seems to be 50. One thing you may want to take care of, is to increase the e_period to a value higher than the normal_speed, that would seem more sensible to me, given that having a normal_speed higher than the e-period, would be to modify an information based on more data with another one based on less data. If therefore you want to put normal_speed at 50, I would think e_period should be something like 60, keep in mind though that this will slow down a bit the time response on your computer, given that the program will do more calculations than before, on my PC, it still not too much of a problem, though, change of time-scale gets a bit slower.

Hope this helps, if you are any more doubts or questions, you are welcome to ask me again.

Cheers

Jean-Philippe


 
jppoton:
tsheppard:

Hi Jean-Philippe,

I hope you're doing well.

I've downloaded FRASMA and find it fascinating, but I'm not a very mathematical person. I spent quite a long time reading your blog and I must say I'm more confused now than before I went :)

I understood clearly your explanation of using SMA over EMA which would seem to make perfect sense, if indeed you are an intra-day trader as I am.

What I wasn't clear on, and could not find a clear understanding of on your blog are the settings to use when replacing a current SMA/EMA with FRASMA.

I assume that e_period and e_type_data would be the Period: and Apply to: settings of the current moving average that you're replacing, but I have no idea what the normal_speed setting should be, or how I should calculate it.

For instance, I am currently using a 50 period, weighted EMA which I would like to replace with a 50 Period FRASMA.

Since it's not possible to utilize a weighted close, (FRASMA does not allow e_type_data > 3), how would I set this up, and most importantly for future reference, how does one calculate the normal_speed of a FRASMA?

Thank you so much for your hard work and your great contribution to the community :)

Tai

Hi Tai,

Thanks for your interesting comments.

As for your questions, the e_period is not directly used in relation with the FRASMA, but rather is the number of bars used to calculate the Fractal Graph Dimension, fdi in the program, via the line:

fdi=1.0 +(MathLog( length)+ LOG_2 )/MathLog( 2 * e_period );

This fdi is then, in turn used to calculate the Trail dimension:

trail_dim=1/(2-fdi);

Then the alpha is half of this Trail dimension, and this alpha is then used to calculate the resulting fractalised speed of the FRASMA which really is an SMA with a variable fractalised speed:

speed=MathRound(normal_speed*alpha);
ExtOutputBuffer[pos]=iMA(NULL,0,speed,0,0,0,pos);


As for the normal_speed, it really is the speed you want the SMA to be in when there is no need to fractalise it, it therefore is the speed of your SMA before it becomes the FRASMA, which in your case, seems to be 50. One thing you may want to take care of, is to increase the e_period to a value higher than the normal_speed, that would seem more sensible to me, given that having a normal_speed higher than the e-period, would be to modify an information based on more data with another one based on less data. If therefore you want to put normal_speed at 50, I would think e_period should be something like 60, keep in mind though that this will slow down a bit the time response on your computer, given that the program will do more calculations than before, on my PC, it still not too much of a problem, though, change of time-scale gets a bit slower.

Hope this helps, if you are any more doubts or questions, you are welcome to ask me again.

Cheers

Jean-Philippe





Excellent, thanks Jean-Philippe.

I did have one other question, it may be a silly one considering my math expertise is limited, but is there a specific reason that you did not include typical, median and weighted prices?

I added them into my version, slightly modifying the code in FGDI, and they seem to work fine.

No big deal just wondering.

Thanks again.

Tai

 
tsheppard:
jppoton:
tsheppard:

Hi Jean-Philippe,

I hope you're doing well.

I've downloaded FRASMA and find it fascinating, but I'm not a very mathematical person. I spent quite a long time reading your blog and I must say I'm more confused now than before I went :)

I understood clearly your explanation of using SMA over EMA which would seem to make perfect sense, if indeed you are an intra-day trader as I am.

What I wasn't clear on, and could not find a clear understanding of on your blog are the settings to use when replacing a current SMA/EMA with FRASMA.

I assume that e_period and e_type_data would be the Period: and Apply to: settings of the current moving average that you're replacing, but I have no idea what the normal_speed setting should be, or how I should calculate it.

For instance, I am currently using a 50 period, weighted EMA which I would like to replace with a 50 Period FRASMA.

Since it's not possible to utilize a weighted close, (FRASMA does not allow e_type_data > 3), how would I set this up, and most importantly for future reference, how does one calculate the normal_speed of a FRASMA?

Thank you so much for your hard work and your great contribution to the community :)

Tai

Hi Tai,

Thanks for your interesting comments.

As for your questions, the e_period is not directly used in relation with the FRASMA, but rather is the number of bars used to calculate the Fractal Graph Dimension, fdi in the program, via the line:

fdi=1.0 +(MathLog( length)+ LOG_2 )/MathLog( 2 * e_period );

This fdi is then, in turn used to calculate the Trail dimension:

trail_dim=1/(2-fdi);

Then the alpha is half of this Trail dimension, and this alpha is then used to calculate the resulting fractalised speed of the FRASMA which really is an SMA with a variable fractalised speed:

speed=MathRound(normal_speed*alpha);
ExtOutputBuffer[pos]=iMA(NULL,0,speed,0,0,0,pos);


As for the normal_speed, it really is the speed you want the SMA to be in when there is no need to fractalise it, it therefore is the speed of your SMA before it becomes the FRASMA, which in your case, seems to be 50. One thing you may want to take care of, is to increase the e_period to a value higher than the normal_speed, that would seem more sensible to me, given that having a normal_speed higher than the e-period, would be to modify an information based on more data with another one based on less data. If therefore you want to put normal_speed at 50, I would think e_period should be something like 60, keep in mind though that this will slow down a bit the time response on your computer, given that the program will do more calculations than before, on my PC, it still not too much of a problem, though, change of time-scale gets a bit slower.

Hope this helps, if you are any more doubts or questions, you are welcome to ask me again.

Cheers

Jean-Philippe





Excellent, thanks Jean-Philippe.

I did have one other question, it may be a silly one considering my math expertise is limited, but is there a specific reason that you did not include typical, median and weighted prices?

I added them into my version, slightly modifying the code in FGDI, and they seem to work fine.

No big deal just wondering.

Thanks again.

Tai

Hi Tai,

No, you are right, it's a mistake on my part, you are perfectly justified to use the typical, median and weighted price as you see fit. I just forgot to add them.

Cheers

Jean-Philippe

 

For anyone who would like to add support for median, typical, or weighted pricing to their FRASMA or FRASMAv2 please replace the _computeLastNbBars function with the below:

Just recompile and all should work as normal.

Tai

void _computeLastNbBars( int lastBars )
  {
   int pos;
   switch( e_type_data )
     {
      case PRICE_CLOSE    : _FRASMA( lastBars, Close ); break;
      case PRICE_OPEN     : _FRASMA( lastBars, Open ); break;
      case PRICE_HIGH     : _FRASMA( lastBars, High ); break;
      case PRICE_LOW      : _FRASMA( lastBars, Low ); break;
      case PRICE_MEDIAN   :
         for( pos=lastBars; pos>=0; pos--)ExtOutputBuffer[pos]=(High[pos]+Low[pos])/2.0; _FRASMA( lastBars, ExtOutputBuffer );
         break;
      case PRICE_TYPICAL  :
         for( pos=lastBars; pos>=0; pos--)ExtOutputBuffer[pos]=(High[pos]+Low[pos]+Close[pos])/3.0; _FRASMA( lastBars, ExtOutputBuffer );
         break;
      case PRICE_WEIGHTED :
         for( pos=lastBars; pos>=0; pos--)ExtOutputBuffer[pos]=(High[pos]+Low[pos]+Close[pos]+Close[pos])/4.0; _FRASMA( lastBars, ExtOutputBuffer );
         break;
      default :
         Alert( "[ 20-ERROR  " + FILENAME + " ] the imput parameter e_type_data <" + e_type_data + "> is unknown" );
     }
  }
 

jppoton, thanks for good idea. +10.

 

Thank you Jean-philipee,

This indicator is very useful, I tested on the demo account and I am making decent profit!!!  It is awesome! This is probably  the best indicator so far.  I use the blue line crosses the e_random_line 1.5 from fractal dimension to turn the color red as a signal of a breakout. With the combination of FRASMA to identify the direction of trend. or

Unfortunately I am not watching my chart 24-7. What I think it will help me save alot of time. \

Can you add "fractal dimension" a alert indicator to my email.An alert indicator that whenever the blue line crosses over the e_random_line 1.5 or crossover please!! :) 

my email is peteramaro@yahoo.com.

Thank you and Merry Christmas!! 

 

Hi Jean,

Can you tell me how is the calculation of this fractal dimension?. How many dot do you use for the lineal regresion of  R/S? The 30 that appear in the indicator what means, the number of data? Thanks!

Reason: