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:
Attempt 1
1
2
3
4
5
IFLOW>LowPointaveTHEN
LowAdd=LowAdd+1
ELSE
LowAdd=LowAdd-1
ENDIF
Result was the indicator just flipped between 1 and -1.
Attempt 2 – Using Loops
attempt 2
1
2
3
4
5
6
7
8
9
10
IFLOW>LowPointaveTHEN
i=1
ELSE
i=0
ENDIF
LowAdd=0
WHILEi=1DO
LowAdd=LowAdd+1
WEND
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?
To help us continually offer you the best experience on ProRealCode, we use cookies. By clicking on "Continue" you are agreeing to our use of them. You can also check our "privacy policy" page for more information.Continue