I have an indicator that I want to find out how often it reaches a certain level.
I use the for loop; for(int i=1;i<limit;i++) - To get the bar count.
Lets say the indicator I have goes from -10 through to +10. And I want to find out how many times it reached +9 or more for say 48 bars. Is it possible to code this? The way I would think it would be done is by using the result I get from the indicator, and doing a if statement. So if(Result => 9){ int average = 1;}
But when I do this if the value of result did reach 9 or more it just displays number 1, and doesnt count it.
So lets say there are 48 bars I want to find out how often it reaches that level. Somehow it needs add 1 for each time it reaches 9 +. So the indicator reaches 9 or more, 10 times over that 48 bar period, i need to get that result.
Any help greatly appreciated.
On re-thinking i think I need to use ++ to get it to add to the last result so that it counts. so ( result++).
I use the for loop; for(int i=1;i<limit;i++) - To get the bar count.
Lets say the indicator I have goes from -10 through to +10. And I want to find out how many times it reached +9 or more for say 48 bars. Is it possible to code this? The way I would think it would be done is by using the result I get from the indicator, and doing a if statement. So if(Result => 9){ int average = 1;}
But when I do this if the value of result did reach 9 or more it just displays number 1, and doesnt count it.
So lets say there are 48 bars I want to find out how often it reaches that level. Somehow it needs add 1 for each time it reaches 9 +. So the indicator reaches 9 or more, 10 times over that 48 bar period, i need to get that result.
Any help greatly appreciated.
On re-thinking i think I need to use ++ to get it to add to the last result so that it counts. so ( result++).