Fractals are used to identify market structure — a moment t where:
Down fractal:
Low(t) <= Lowest(t-a, t+b)
for the minimum in domain [t-a, t+b]
Up fractal:
High(t) >= Highest(t-a, t+b)
for the maximum in domain [t-a, t+b]
Example:
If lookback = 20 and a = b = 3
Assume that at time t = i = 10 (bar index, where 0 is current, 1 is previous, n is nth bar, etc.):
Lowest(10-3, 10+3) → Lowest(7 to 13) = Low(10)
Then t = 10 is a down fractal.
Reference:
Here is the code of the existing indicator (X-bars Fractals from Serhii Ivanenko) that would be great to convert for ProRealTime users:
https://www.mql5.com/en/code/1381
Thank you !