Support and resistance zones with variables arrays

Forums ProRealTime English forum ProBuilder support Support and resistance zones with variables arrays

Viewing 15 posts - 1 through 15 (of 24 total)
  • #125286

    Hello,

    I copied the code posted by Nicolas in his arrays post and tried to improve  it. Unfortunately I couldn’t;)

    In detail, I modified 3 points:

    • the fractal to find the top and bottoms, but it’s a detail
    • I’m mixing bottoms and tops to find overlap, instead of classic support and resistance
    • to avoid having multiple zone mixing each other around the same price, I tried to add a third array, in order to store the levels found, and then displayed only those which have enough space space between them. However, this is the part bugging…

    Does someone knows how to fix the third point? I think the error is around the part:

    for x=0 to lastset($overlap) do

    if abs(($BOTy[y]+$TOPy[i])/2 – $overlap[x])>percent*2 then

    count=count+1

    endif

    if count=lastset($overlap) then

    ….

     

     

    1 user thanked author for this post.
    #125295

    Your overlapping filter is a good idea! Did you try to just take a small part of the code and debug it? For instance, build a code with only support zones and check your overlap function. I know how hard it is, the first time to build PRT codes with arrays! 😉

    #125300

    I thought the error was around the count, so I inverted a bit the code as below.  The problem is that I get an error of the type “infinite loop or too much iteration”

     

     

    #125305

    what is weird is that if I cut my code by two, first I see the rectangles displayed on the chart during a few second, then the error message appears and the rectangle disappears with it…Maybe a bug remaining with this new array feature?

     

     

    #125389

    The problem is that you continuously increase the index of the $overlap array in the for x/next loop, while this loop is based on the quantity of index of this specific array, so it results as an infinite loop.

    You should build an array of possible support resistance zones in the first place. Then create a specific loop through this price zones array and exclude the overlapping ones in order to plot them.

     

    #125562

    Ok thx very much for your feedback. Actually, I had your solution in mind as backup but the downside is/was that you are losing some info in the process, as I’m storing only the midpoint levels.

    Anyway please find here under a first draft of indicator drawing automatically what I call overlap levels (so levels that have been both support and resistance)…

     

     

    #125564

    being able to create such indicator is a huge step forward for PRT! if other participants can take this base to a higher level, this could be a cornerstone to create a profitable robot

    1 user thanked author for this post.
    #125566

    Small improvement, drawing segment instead of line

     

     

     

    #125568

    Thank you for this very nice fork of the original indicator. A great addition would be to start plotting the lines (as segments) from the bar when the level is found for the first time, sounds tricky but possible.

    #125572

    this is what the second version I posted is doing, nope?

    #125576

    Yes! You replied before me, thanks 🙂

    #125711

    I  still found and resolved major bugs in my code, but unless there are other participants willing to build on this, don’t see the point to continue this thread

    1 user thanked author for this post.
    #125822

    I strongly encourage to continue posting your valuable input.  Once a while someone will pop into the discussion.  It usually happens like this in the forums. Sadly, I can’t get involved into each interesting topic created by members,  due to lack of time,  going from problem to another.. anyway, I’m subscribing to the thread! thanks again for giving back to the community! 🙂

    1 user thanked author for this post.
    #125901

    Yep you right but always difficult when you have the impression that’s more a one way virtual relationship…

    So anyway, I’m posting the last version I have, which worked great yesterday on the WE static data, but now that prices move again, I get the famous error message “infinite loop or too much iteration”

    the error is here when I use two loops to compare one value of an array with all other values of the same array, but I can not see why I would have an infinite loop…

     

     

     

     

     

    #125913

    I have not tested yet, but 2 ways to improve the loop:

    1/ is it needed to start the nested loop at the beginning of the array?

    2/ while increasing the index with lastset($overlapfinal)+1, is a good idea, it sometimes overload the array without reason. 

    try instead to create a variable that store the index number and re-use it at each run of the code:

    at start of the code and before creating the array:

    then, while populating the array:

    by doing this, it will considerably reduce the array size and therefore limiting the infinite loop issue!

     

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

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