hello guys, can someone help me to write this loop for an indicator, there are many days that I try but I can't do !!!
- the beginning of the loop is the bar before today - the loop length is the variable PER (for example 10) *** Then the loop works from BAR -1 to BAR -10 *** PER=10; XXX= my expression; DIFF=0; set variable to 0 CONT=0; set variable to 0 in the loop: If XXX > DIFF then DIFF = XXX and CONT assumes the number of backwards bar in the loop for example: BAR -1 XXX > 0 cont = 1 BAR -2 XXX > diff cont = 2 BAR -3 XXX > diff cont = 3 BAR -4 XXX > diff cont = 4 BAR -5 XXX > diff cont = 5 BAR -6 XXX > diff cont = 6 BAR -7 XXX < diff cont = 6 break loop, CONT assumes 6 BAR -8 XXX < diff cont = 6 BAR -9 XXX > diff cont = 6 BAR -10 XXX > diff cont = 6 The main problem is how to set the beginning of the loop and how to assign values to the arrays earlier in reverse from the usual. I hope I was clear, thanks for the reply. Angio
