Is there a way to calculate the highest & lowest point of an indicator in a set range

 

Greetings

I am not a programmer (just know enough to be dangerous) and need some help programming the highest & lowest point of an indicator in the last 30 60 bars.

I can do it with to the price range with no problem

Example:

double L_Range=(Low[iLowest(NULL,TI,1,30,1)]);

double H_Range=(High[iHighest(NULL,TI,2,30,1)]);

But… how would I do this to an indicator

Example:

If Stochastic has gone above 80 or below 20 in the past 30 bars.

Thank you in advance.

 
One way . . . read all the values into an array, sort the array, read the first and last entries then you have the highest and lowest.
 
I_Need_Money:

Greetings

I am not a programmer (just know enough to be dangerous) and need some help programming the highest & lowest point of an indicator in the last 30 60 bars.

Raptor's solution will work but the computational "expense" would be offensive to programmers.

This is a very common type of solution ...

double max = -1.0;
double min = 10000000.0;

for( int n=1; n<30; n++ ){
   double val = iStochastic(NULL,0,5,3,3,MODE_SMA,0,MODE_MAIN,n);
   
   if( max < val )
       max = val;
       
   if( min > val )
       min = val;
}

I have just put any old values into the Stochastic indicator as it is an example.

 
dabbler:

Raptor's solution will work but the computational "expense" would be offensive to programmers.

This is a very common type of solution ...

I have just put any old values into the Stochastic indicator as it is an example.


Thank you will give this a try.

Reason: