#### Topic: Fractals

FSB uses 7 types of fractals

``````            for(int iBar=8; iBar<Bars-1; iBar++)
{
if(High[iBar-1]<High[iBar-2] && High[iBar]<High[iBar-2])
{
// Fractal type 1
if( High[iBar-4]<High[iBar-2] &&
High[iBar-3]<High[iBar-2] )
afFrUp[iBar+1]=High[iBar-2];

// Fractal type 2
if( High[iBar-5]< High[iBar-2] &&
High[iBar-4]< High[iBar-2] &&
High[iBar-3]==High[iBar-2] )
afFrUp[iBar+1]=High[iBar-2];

// Fractal type 3, 4
if( High[iBar-6]< High[iBar-2] &&
High[iBar-5]< High[iBar-2] &&
High[iBar-4]==High[iBar-2] &&
High[iBar-3]<=High[iBar-2] )
afFrUp[iBar+1]=High[iBar-2];

// Fractal type 5
if( High[iBar-7]< High[iBar-2] &&
High[iBar-6]< High[iBar-2] &&
High[iBar-5]==High[iBar-2] &&
High[iBar-4]< High[iBar-2] &&
High[iBar-3]==High[iBar-2] )
afFrUp[iBar+1]=High[iBar-2];

// Fractal type 6
if( High[iBar-7]< High[iBar-2] &&
High[iBar-6]< High[iBar-2] &&
High[iBar-5]==High[iBar-2] &&
High[iBar-4]==High[iBar-2] &&
High[iBar-3]< High[iBar-2] )
afFrUp[iBar+1]=High[iBar-2];

// Fractal type 7
if( High[iBar-8]< High[iBar-2] &&
High[iBar-7]< High[iBar-2] &&
High[iBar-6]==High[iBar-2] &&
High[iBar-5]< High[iBar-2] &&
High[iBar-4]==High[iBar-2] &&
High[iBar-3]< High[iBar-2] )
afFrUp[iBar+1]=High[iBar-2];
}

if(Low[iBar-1]>Low[iBar-2] && Low[iBar]>Low[iBar-2])
{
// Fractal type 1
if( Low[iBar-4]>Low[iBar-2] &&
Low[iBar-3]>Low[iBar-2] )
afFrDn[iBar+1]=Low[iBar-2];

// Fractal type 2
if( Low[iBar-5]> Low[iBar-2] &&
Low[iBar-4]> Low[iBar-2] &&
Low[iBar-3]==Low[iBar-2] )
afFrDn[iBar+1]=Low[iBar-2];

// Fractal type 3, 4
if( Low[iBar-6]> Low[iBar-2] &&
Low[iBar-5]> Low[iBar-2] &&
Low[iBar-4]==Low[iBar-2] &&
Low[iBar-3]>=Low[iBar-2] )
afFrDn[iBar+1]=Low[iBar-2];

// Fractal type 5
if( Low[iBar-7]> Low[iBar-2] &&
Low[iBar-6]> Low[iBar-2] &&
Low[iBar-5]==Low[iBar-2] &&
Low[iBar-4]> Low[iBar-2] &&
Low[iBar-3]==Low[iBar-2] )
afFrDn[iBar+1]=Low[iBar-2];

// Fractal type 6
if( Low[iBar-7]> Low[iBar-2] &&
Low[iBar-6]> Low[iBar-2] &&
Low[iBar-5]==Low[iBar-2] &&
Low[iBar-4]==Low[iBar-2] &&
Low[iBar-3]> Low[iBar-2] )
afFrDn[iBar+1]=Low[iBar-2];

// Fractal type 7
if( Low[iBar-8]> Low[iBar-2] &&
Low[iBar-7]> Low[iBar-2] &&
Low[iBar-6]==Low[iBar-2] &&
Low[iBar-5]> Low[iBar-2] &&
Low[iBar-4]==Low[iBar-2] &&
Low[iBar-3]> Low[iBar-2] )
afFrDn[iBar+1]=Low[iBar-2];
}
}``````

#### Re: Fractals

Excellent Popov!
Thank you for the code.

#### Re: Fractals

Does FSB use all of these in the opening point Fractal or just the common one that metatrader uses like your number 1?

#### Re: Fractals

FSB checks for all 7 combinations starting from the first type.

#### Re: Fractals

А для чего этот код. Это что стратегия если стратегия то выложите ее в виде файла.

#### Re: Fractals

Popov wrote:

FSB checks for all 7 combinations starting from the first type.

Dear popov Could you alter the fractal code to use and or !!!not and only

#### Re: Fractals

How can I import this code into FSB? Thanks

#### Re: Fractals

toughware wrote:

How can I import this code into FSB? Thanks

it's standard built-in indicator

#### Re: Fractals

Hi Popov,

Can you share me the Mt4 or MT5 file of this indicator?

Regards,
Sujay

#### Re: Fractals

ssijbabu wrote:

Hi Popov,

Can you share me the Mt4 or MT5 file of this indicator?

Regards,
Sujay

I've never seen a MT4 without a fractal indi...

#### Re: Fractals

I saw the code but it is recognizing only the first pattern. And also instead of showing line it is showing arrows.

i want the one exactly as it is showing in FSB. (line instead of arrow and all patterns)

#### Re: Fractals

Hi

Could you add an opening logic to the Fractal Indi so that i can use the fractal as stop instead of entry ?
I would like to  test the following .
On Bar close if previous Bar has down Fractal go long with stop loss at fractal value