Finding last two Fractals position

Forums ProRealTime English forum ProBuilder support Finding last two Fractals position

Viewing 9 posts - 1 through 9 (of 9 total)
  • #39154

    Hi Guys,

    I am trying to write some code to find the time (index) when the last two low Fractals occurred, or the last two High Fractals occurred.

    I want to use their positional information to calculate Fractal divergence against an indicator.

    I am struggling as the normal Fractal code uses the “lowest” function which works for the last Fractal, but does not allow an offset to find the 2nd to last Fractal.

    Any help much appreciated.

    B.

    #39222

    You can make a new variable that store the previous high fractal barindex if a new high one is found. This way, you should be able to compare the current fractal barindex to the previous one stored in a variable.

    #39248

    Thanks Nicolas,

    I am having trouble with how to store the previous Fractal, in the code snippet (just the low Fractal):

    I don’t know how/when to save the CurrentLF to PreviousLF

    Cheers

     

    #39279

    You could do it this way instead:

    So now you have continuously a set of 2 low fractals barindex stored.

    #39337

    Thanks Nicolas, wasn’t thinking 😉

    #147345

    Hi im trying to find the values of the previous THREE factals. Having trouble.

    Can somebody help me?

    #147351

    This Nicolas’code modified to accomodate for another two places:

    so you can now access Previous1LF, Previous2LF and Previous3LF.

    1 user thanked author for this post.
    #147353

    Thankyou for your reply.

    If i want to find the value(high or low) of a previous factal such as ‘previous3LF’, is this code correct?

     

    #147356

    No, you should write:

    Because if now it’s BarIndex 100 and previous3LF is 81, then you have to access the 19th previous bar to get the correct value.

    1 user thanked author for this post.
Viewing 9 posts - 1 through 9 (of 9 total)

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