Convert X-bars Fractals Indicator (Serhii Ivanenko, MQL5) to ProRealTime

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #249620 quote
    David1998P
    Participant
    New

    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 !

    fractals.png fractals.png
    #249627 quote
    JS
    Participant
    Senior
    Hi, Try this one…
    Once NLB=5 //Number Left Bars
    Once NRB=5 //Numer Right Bars
    
    
    TB=NLB+NRB //TotalBars
    fp=NRB+1 //fp=fractal point
    
    If High[fp]=Highest[TB+1](High) then
    DrawArrowUp(BarIndex-fp,High[fp]) Coloured("Blue")
    EndIf
    
    If Low[fp]=Lowest[TB+1](Low) then
    DrawArrowDown(BarIndex-fp,Low[fp]) Coloured("Green")
    endIf
    
    Return
    robertogozzi thanked this post
    #249692 quote
    David1998P
    Participant
    New
    Thanks but it does not work…
    #249695 quote
    JS
    Participant
    Senior

    Have you tried it, because it works fine for me…

    What doesn’t work…?
    Scherm­afbeelding-2025-08-13-om-11.17.02.png Scherm­afbeelding-2025-08-13-om-11.17.02.png
    #249753 quote
    David1998P
    Participant
    New
    When I tried it yesterday during regular trading hours, it didn’t work. Now that I’ve tried it when the market is closed, it mostly works. This happens sometimes to me with other indicators as well. I wonder why… But there are many false positives. Take a look at the screenshots here where NLB and NRB = 2; there are many examples of the displayed fractal not being the local min or max of the candle range (t-2, t+2, so in total 5 candles). Do you know why this happens?
    FMST.png FMST.png AAPL.png AAPL.png
    #249761 quote
    JS
    Participant
    Senior

    Hi,

    Try this one… (small addition error)

    Once NLB=2 //Number Left Bars
    Once NRB=2 //Numer Right Bars
    
    
    TB=NLB+NRB //TotalBars
    fp=NRB //fp=fractal point
    
    If High[fp]=Highest[TB+1](High) then
    DrawArrowUp(BarIndex-fp,High[fp]) Coloured("Blue")
    EndIf
    
    If Low[fp]=Lowest[TB+1](Low) then
    DrawArrowDown(BarIndex-fp,Low[fp]) Coloured("Green")
    endIf
    
    Return
    David1998P thanked this post
Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.

Convert X-bars Fractals Indicator (Serhii Ivanenko, MQL5) to ProRealTime


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
David1998P @david1998p Participant
Summary

This topic contains 5 replies,
has 2 voices, and was last updated by JS
6 months, 2 weeks ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 08/11/2025
Status: Active
Attachments: 4 files
Logo Logo
Loading...