“In order for a fractal to form, there should be a series of 5 consecutive bars where the middle bar will be the highest preceded and followed by two lower neighbouring bars on each side.”
Since this indicator is frequently requested on forums, I put the code here (author: SOHOCOOL).
Fractals can be used in many different approach:
The “Low Fractal” and “High Fractal” may be set to ‘points’ style in the platform to have a clearer view of them on the price chart.
/////////// FRACTALS BILL WILLIAMS
//Variable:
//cp = 2 (default)
if high[cp] >= highest[2*cp+1](high) then
LH = 1
else
LH=0
endif
if low[cp] <= lowest[2*cp+1](low) then
LL= -1
else
LL=0
endif
if LH=1 then
hil = high[cp]
endif
if LL = -1 then
LOL=low[cp]
endif
return lol coloured(255,0,0) as "Low Fractal",hil coloured(0,255,0) as "High Fractal"
/////////////end