A measure of fractal self similarity Indicator For MT4

A measure of fractal self similarity Indicator For MT4

The A measure of fractal self similarity Indicator For MT4 calculates the price movement in a different time frame and gives the traders a clear clue regarding the stance of the bulls and bears. The fractal calculations are very precious and you need to learn more about the tools so that you can take the perfect shots at the market.

FREE A measure of fractal self-similarity Indicator

Download the FREE A measure of fractal self-similarity Indicator for MT4.

To receive my email 100% sure: 
Put my email on your whitelist!

 

Partially Automated Trading Besides Your Day Job

Alerts In Real-Time When Divergences Occur

My Recommended MT4/MT5 Broker

 

Installing the A measure of fractal self similarity Indicator For MT4

After you downloaded the indicator via the form above you need to unzip the zip-file. Then you need to copy the file MTF_FractalDispersion11.mq4 into the folder MQL4\Indicators of your MT4 installation. After that please restart MT4 and then you will be able to see the indicator in the list of indicators.

Parameters of the A measure of fractal self similarity Indicator For MT4

The A measure of fractal self similarity Indicator For MT4 has 8 parameters to configure.

extern int    e_period      =30;
extern int    e_type_data   =PRICE_CLOSE;
extern int    M5w           =1;
extern int    M15w          =1;
extern int    M30w          =1;
extern int    M60w          =1;
extern int    M240w         =0;
extern int    M1440w        =0;

Buffers of the A measure of fractal self similarity Indicator For MT4

The A measure of fractal self similarity Indicator For MT4 provides 1 buffers.

SetIndexBuffer( 0, OutputBuffer );

Main Parts Of The Code

//| FUNCTION : start                                                 |
//| This callback is fired by metatrader for each tick               |
//+------------------------------------------------------------------+
int start()
  {
   int counted_bars = IndicatorCounted();
   if(counted_bars  lt  0)  return(-1);
   if(counted_bars  gt  0)   counted_bars--;
   int limit = Bars - counted_bars;
   if(counted_bars==0) limit-=1+e_period;
   
   _computeLastNbBars(limit);
//----
   return( 0 );
  }
//+================================================================================================================+
//+=== FUNCTION : _computeLastNbBars                                                                            ===+
//+===                                                                                                          ===+
//+===                                                                                                          ===+
//+=== This callback is fired by metatrader for each tick                                                       ===+
//+===                                                                                                          ===+
//+=== In :                                                                                                     ===+
//+===    - lastBars : these "n" last bars must be repainted                                                    ===+
//+===                                                                                                          ===+
//+================================================================================================================+
double TmpArray[];
//+------------------------------------------------------------------+
//| FUNCTION : _computeLastNbBars                                    |
//| This callback is fired by metatrader for each tick               |
//| In : - lastBars : these "n" last bars must be repainted          | 
//+------------------------------------------------------------------+
void _computeLastNbBars( int lastBars )
  {
   int pos;
   switch( e_type_data )
     {
      case PRICE_CLOSE    : ArrayCopy(TmpArray,Close,0,0,WHOLE_ARRAY); FractalDispersion( lastBars, TmpArray ); break;
      case PRICE_OPEN     : ArrayCopy(TmpArray,Open,0,0,WHOLE_ARRAY); FractalDispersion( lastBars, TmpArray ); break;
      case PRICE_HIGH     : ArrayCopy(TmpArray,High,0,0,WHOLE_ARRAY); FractalDispersion( lastBars, TmpArray ); break;
      case PRICE_LOW      : ArrayCopy(TmpArray,Low,0,0,WHOLE_ARRAY); FractalDispersion( lastBars, TmpArray ); break;
      case PRICE_MEDIAN   :
         for( pos=lastBars; pos gt =0; pos--)InputBuffer[pos]=(High[pos]+Low[pos])/2.0; FractalDispersion( lastBars, InputBuffer );
         break;
      case PRICE_TYPICAL  :
         for( pos=lastBars; pos gt =0; pos--)InputBuffer[pos]=(High[pos]+Low[pos]+Close[pos])/3.0; FractalDispersion( lastBars, InputBuffer );
         break;
      case PRICE_WEIGHTED :
         for( pos=lastBars; pos gt =0; pos--)InputBuffer[pos]=(High[pos]+Low[pos]+Close[pos]+Close[pos])/4.0; FractalDispersion( lastBars, InputBuffer );
         break;
      default :
         Alert( "[ 20-ERROR  " + FILENAME + " ] the imput parameter e_type_data  lt " + e_type_data + " gt  is unknown" );
     }
  }
//+------------------------------------------------------------------+
//| FUNCTION : FractalDispersion                                     |
//| Compute the dispersion of the fractal dimensions around the      | 
//| chosen TimeFrame from input data.                                |
//| In :                                                             |
//|    - lastBars : these "n" last bars must be repainted            |
//|    - inputData : data array on which the FGDI will be applied     |
//+------------------------------------------------------------------+
void FractalDispersion( int lastBars, double &inputData[] )
  {
   int    pos;
   double M5fdi[];
   double M15fdi[];
   double M30fdi[];
   double M60fdi[];
   double M240fdi[];
   double M1440fdi[];
   double M5dev,M15dev,M30dev,M60dev,M240dev,M1440dev,sigma;
   
   int size=lastBars*288;
   
   ArrayResize(M5fdi,size);
   ArrayResize(M15fdi,size);
   ArrayResize(M30fdi,size);
   ArrayResize(M60fdi,size);
   ArrayResize(M240fdi,size);
   ArrayResize(M1440fdi,size);
   
//----
   for( pos=lastBars; pos gt =0; pos-- )
     {
//----Calculation of the fractal dimension on all the timeframes and storage of their values in M_fdi[] arrays
      if (iCustom(Symbol(),5,"FGDI",e_period,e_type_data,1.5,0,pos)==EMPTY_VALUE)
         {M5fdi[pos]=iCustom(Symbol(),5,"FGDI",e_period,e_type_data,1.5,1,pos);}
         else
         {M5fdi[pos]=iCustom(Symbol(),5,"FGDI",e_period,e_type_data,1.5,0,pos);}
      
      if (iCustom(Symbol(),15,"FGDI",e_period,e_type_data,1.5,0,pos)==EMPTY_VALUE)
         {M15fdi[pos]=iCustom(Symbol(),15,"FGDI",e_period,e_type_data,1.5,1,pos);}
         else
         {M15fdi[pos]=iCustom(Symbol(),15,"FGDI",e_period,e_type_data,1.5,0,pos);}
      
      if (iCustom(Symbol(),30,"FGDI",e_period,e_type_data,1.5,0,pos)==EMPTY_VALUE)
         {M30fdi[pos]=iCustom(Symbol(),30,"FGDI",e_period,e_type_data,1.5,1,pos);}
         else
         {M30fdi[pos]=iCustom(Symbol(),30,"FGDI",e_period,e_type_data,1.5,0,pos);}
      
      if (iCustom(Symbol(),60,"FGDI",e_period,e_type_data,1.5,0,pos)==EMPTY_VALUE)
         {M60fdi[pos]=iCustom(Symbol(),60,"FGDI",e_period,e_type_data,1.5,1,pos);}
         else
         {M60fdi[pos]=iCustom(Symbol(),60,"FGDI",e_period,e_type_data,1.5,0,pos);}
      
      if (iCustom(Symbol(),240,"FGDI",e_period,e_type_data,1.5,0,pos)==EMPTY_VALUE)
         {M240fdi[pos]=iCustom(Symbol(),240,"FGDI",e_period,e_type_data,1.5,1,pos);}
         else
         {M240fdi[pos]=iCustom(Symbol(),240,"FGDI",e_period,e_type_data,1.5,0,pos);}
      if (iCustom(Symbol(),1440,"FGDI",e_period,e_type_data,1.5,0,pos)==EMPTY_VALUE)
         {M1440fdi[pos]=iCustom(Symbol(),1440,"FGDI",e_period,e_type_data,1.5,1,pos);}
         else
         {M1440fdi[pos]=iCustom(Symbol(),1440,"FGDI",e_period,e_type_data,1.5,0,pos);}          
     
//------------------------------------------------------------------------------------------------------
//----Calculation of the deviation between the fractal dimensions of different timeframes, this 
//----necessitates to shift the indexes between different arrays in order to have homogeneous values of
//----the fractal dimension, i.e, values that correspond to the same instant.
//------------------------------------------------------------------------------------------------------         
      if (M1440w gt 0)
         {M5dev=M5w*MathPow(M5fdi[pos*288]-M1440fdi[pos],2);
          M15dev=M15w*MathPow(M15fdi[pos*96]-M1440fdi[pos],2);
          M30dev=M30w*MathPow(M30fdi[pos*48]-M1440fdi[pos],2);
          M60dev=M60w*MathPow(M60fdi[pos*24]-M1440fdi[pos],2);
          M240dev=M240w*MathPow(M240fdi[pos*6]-M1440fdi[pos],2);
          M1440dev=0.0;}
      else if (M240w gt 0)
              {M5dev=M5w*MathPow(M5fdi[pos*48]-M240fdi[pos],2);
               M15dev=M15w*MathPow(M15fdi[pos*16]-M240fdi[pos],2);
               M30dev=M30w*MathPow(M30fdi[pos*8]-M240fdi[pos],2);
               M60dev=M60w*MathPow(M60fdi[pos*4]-M240fdi[pos],2);
               M240dev=0.0;
               M1440dev=0.0;}
           else if (M60w gt 0)
                   {M5dev=M5w*MathPow(M5fdi[pos*12]-M60fdi[pos],2);
                    M15dev=M15w*MathPow(M15fdi[pos*4]-M60fdi[pos],2);
                    M30dev=M30w*MathPow(M30fdi[pos*2]-M60fdi[pos],2);
                    M60dev=0.0;
                    M240dev=0.0;
                    M1440dev=0.0;}
                else if (M30w gt 0)
                        {M5dev=M5w*MathPow(M5fdi[pos*6]-M30fdi[pos],2);
                         M15dev=M15w*MathPow(M15fdi[pos*2]-M30fdi[pos],2);
                         M30dev=0.0;
                         M60dev=0.0;
                         M240dev=0.0;
                         M1440dev=0.0;}
                     else if (M15w gt 0)
                             {M5dev=M5w*MathPow(M5fdi[pos*3]-M15fdi[pos],2);
                              M15dev=0.0;
                              M30dev=0.0;
                              M60dev=0.0;
                              M240dev=0.0;
                              M1440dev=0.0;}
                          else 
                             {return;}
      if (N gt 1)                            
         {sigma=MathSqrt((M5dev+M15dev+M60dev+M240dev+M1440dev)/(N-1));}
         else
         {sigma=0;}   
      
      OutputBuffer[pos]=10*sigma;   
     } 
  }

 

About Me

I'm Mike Semlitsch the owner of PerfectTrendSystem.com. My trading career started in 2007. Since 2013 I have helped thousands of traders to take their trading to the next level. Many of them are now constantly profitable traders. 

The following performance was achieved by me while trading live in front of hundreds of my clients:

Connect With Me:  

This FREE Indicator Can Transform
Your Trading!

FREE Indicator + Telegram Group


Request the Ultimate Double Top/Bottom Indicator which is used by 10,000+ traders.

Results From 5 Months!
This service starts soon! Be the first who get's notified when it begins!