Haha. Now I realized my mistake. I copy this example somewhere without realizing that it use the Count to index. I ‘assume’ it use the variable i to index.
The correct code should be
1
2
3
4
5
6
7
8
9
10
11
Decrease=Close<Close[1]
Count=0
FORi=0TOBarIndex-1DO
IFDecrease[i]THEN
Count=Count-1
ELSE
BREAK
ENDIF
NEXT
RETURNCount
I learn the danger pf copy/paste code.
Thks everyone for taking interest and interesting comments. Cheers.
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