Increment a Value Failure – Infinite Loops

Forums ProRealTime English forum ProBuilder support Increment a Value Failure – Infinite Loops

Viewing 3 posts - 1 through 3 (of 3 total)
  • #74307

    Hi Everybody,

    I’ve used the forum as a guest for a long time but first post.

    I am trying to build an indicator that increments a value everytime (eachbar) that the IF statement is TRUE and de-increments the value on each bar it is FALSE.

    So for example if the condition had been TRUE for 5 bars the value would equal 5, then if the next bar was FALSE value = 4 and so on.

    Attempt 1 – using IF statements:

    Result was the indicator just flipped between 1 and -1.

     

    Attempt 2 – Using Loops

     

    Result – “An infinite loop or loop with too many iterations was detected….”

     

    What does this mean and is there any way I can meet my goal?

     

    Thanks kindly ,

     

    Jon

     

    #74308

    Your first example works. I tested this:

    and got this:

    Screenshot_1-12

    So it must be whatever your LowPointAve is that is the problem.

    #74322

    You are stuck in the loop between lines 4 and 8,  it will never break because your variable i remains 1 infinitely…

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

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