Define price zone via an indicator

Forums ProRealTime English forum ProBuilder support Define price zone via an indicator

Tagged: , ,

Viewing 4 posts - 1 through 4 (of 4 total)
  • #105517

    Hello,

    I’m looking for help in order to define price zone via a rectangle draw. Let’s say that in my indicator I calculate 5 price variables

    variable1=200, variable2=150,variable3=196,variable4=207,variable5=110

    do you have any idea how I can, sort and group variables together based on distance threshold (so in my exemple only variable1,3,4 would be grouped together because there is less than 15 point distance between them)? The idea finally would be to draw a rectangle between 196 and 207.

    thx for your ideas

    #105519

    To sort 5 variables you’ll have to write:

     

    1 user thanked author for this post.
    #105523

    Thx very much robertogozzi, that’s already very valuable!

    then I guess I can do:

    And repeat that 4 more times (var2-var3<15 etc).and it should work.

    problem maybe is that I have more than 50 variables, so it could become a very very long code.

    So anyone has an idea in order to optimize that by first filtering all variables with price too far from the latest price? But then you add a level of complexity because you don’t know anymore how many variables do you have…

    #105526

    Yes, it’s very complex due to lack of arrays.

    In a future major release they should be added, maybe before the end of 2020?

    Anyway… your code is fine to find the boundaries of the rectangle.

    You can move line 2 before line 1 and remove lines 6, 10 and 14, since the Rect1 will always be = Var1.

    Also in my code lines 60 through 70 are useless, being the last variable.

Viewing 4 posts - 1 through 4 (of 4 total)

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