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.
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.Ok