Joining last 2 swing highs and last 2 swing lows

Forums ProRealTime English forum ProBuilder support Joining last 2 swing highs and last 2 swing lows

Viewing 15 posts - 1 through 15 (of 20 total)
  • #153209

    Hello, with Nicolas’s help the following initial code was generated to draw trend lines.

    Now, I want it to draw only 2 trend lines in the chart- one up trend line joining the last 2 swing lows (2nd swing low must be higher than 1st swing low) and one down trend line joining the last 2 swing highs (2nd swing high must be lower than 1st swing high) as shown in the chart.

    Can any one help me on this please.

    Regards,

     

    #153293

    Any help to identify the dynamic and latest 2 swing highs/ lows to draw the line would be appreciated.

    #153429

    who can

    #153493

    I think Nicolas, Vonasi and others can help.

     

    #153505

    If you are using PRT v11 then you can just use my indicator:

    https://www.prorealcode.com/prorealtime-indicators/every-fractal-trend-lines/

    #153628

    Thank you Vonasi, however IG Markets are still with PRT v10. And most importantly I want only 2 lines on my chart continuously updating itself based on my dynamic requirement as given earlier and below also:

    Trend line joining latest 2 swing highs and latest 2 swing lows to draw the dynamic line

    Regards,

    #153653

    I just reread your first post and I see that there is the additional criteria that the most recent swing low is higher than the second most recent and the opposite for swing highs.

    In v10 we would need to use loops to search back and find each swing high/low and then exit the loop when we find two that meet our criteria – either that or store a mass of individual variables which is all a bit slow and cumbersome. In v11 everything is much easier with the availability of arrays as we can store every swing high/low that there has ever been in a single variable name. The code would be quite simple except if ever there has not been a lower swing low than the latest one or a higher swing high than the latest one because then we need to check back comparing to the second latest swing high/low and so on and so on. If a market has bottomed out at an all time low and formed a swing high there then we won’t be able to find a lower swing low further back in the data.

    v11 also has the ability to draw into the future which v10.3 does not which makes projecting lines forward much easier.

    IG are rolling out v11 country by country at the moment so I can’t imagine that it will be long before Australia gets it.

    I’m a little bit busy with other things at the moment to get started on a new code and I am only coding in v11 now rather than struggle to achieve things I want in v10.3. Hopefully someone else can help you with v10.3 code or let me know when you get v11 and I will try to find some time to code something.

    #153675

    Many thanks dear Vonasi for your detailed response. Appreciate the same. It seems we need to stay in hope that IG will roll v11 sooner than later. I will let you know then.

    Regards,

     

    #153676

    Yes Vonasi, your understanding is correct, “most recent swing low is higher than the second most recent and the opposite for swing highs”.

    #153947

    Hello Vonasi, Great news. I got the version 11 today and now only. Hence I am requesting you to please help me to draw only 2 trend lines in the chart- one up trend line joining the last 2 swing lows (2nd swing low must be higher than 1st swing low) and one down trend line joining the last 2 swing highs (2nd swing high must be lower than 1st swing high). the line should be extended to the right only.

    Can you help me on this please.

    Regards,

    #154086

    Here you go:

     

    #154089

    The above is my first attempt at it. It looks at the latest pair of Fractals and if they are in the correct order (rising or falling) then it uses them. If not in the correct order it moves on to the next pair and checks them until it finds a pair that meets the criteria. This may not be exactly what you want and it will take a while for me to get my head around how to check the latest fractal with all previous fractals before moving to the second latest and checking that against all previous fractals until we find a suitable pairing.

    I’m a bit busy with other stuff right now but will try to find time at some point.

    Personally I think that trend lines are pretty useless as you can draw a line through any two values on a chart and then persuade yourself that it is a valid trend!

    #154092

    It didn’t need much time! Here is a version that checks the latest fractal and looks back for a fractal that meets the criteria. If there isn’t one then it uses the second last fractal and does the same checks. Not extensively tested!

     

    1 user thanked author for this post.
    #154174

    Minor bug fix on the last bit of code that stops some crashes if it can’t find a pair of fractals to use:

     

     

    #154271

    This is just magic at your finger tips. Bravo, my dear. I could not praise more, your helping attitude and un-parallel zest to code something very new. I exactly got what was looking for. I was drawing all these manually. Many thanks dear Vonasi. You are just brilliant.

    On your personal note, I beg to differ with you. Actually it can be extremely helpful if it is used properly in intra-day as enclosed.

    Again, thanks a lot dear.

    Best regards,

Viewing 15 posts - 1 through 15 (of 20 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login