You line of code tests the current RANGE with that of the 10th bar before, but there can be greater ones in the middle!
Try this one:
1
2
y=summation[12](range>range[1])
GRAPHyAS"y"
It makes a sum of your condition for the number of bars in brackets. The output is in how many bars your condition is true, even not consecutively. If you need it to be consecutive you have to test the output against the number in brackets to check if they match.
You could also use FOR…NEXT loops, but it’s far more time consuming!
I tested it on AudCad DAILY and found a match on May 13th, 2013, but the odd thing is that it seems to output a value which is 2 less than the number in brackets. 12 will found 10, 11 will output 9…
Sorry, can’t figure out why, you will have to experiment a bit.
GRAPH is useless for the logic, I used it just for debugging purposes only.
Sorry, but SUMMATION is not the correct instruction, because it checks that each range, from the current one down to the nth one, is greater that the previous. So they need to be consecutively smaller that the previous one.
So the correct solution is to use FOR… NEXT loops:
1
2
3
4
5
6
7
8
9
10
11
12
x=0//let's start the count from 0
fori=1to10
ifrange>range[i]then//range never changes, it is always the current
x=x+1//one and it is tested against all previous ten,
endif//no need for them to be always smaller than
next//the previous one, just smaller than the current one!
ifx=10then//if x = 10 then all 10 previous ranges are less
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