Add a threshold to the Lowest()?

Hello,

Function Lowest() get the lowest value in the ARRAY since the first bar,
is it possible to set a threshlod (limitation) for this (with a much brief way) ?
for example, to get the Lowest Close above 100.
//
We can use for loop to do this as below (but call for a much brief way) :

the_lowest_value_above_100 = 99999;
for( i = 0; i < BarCount; i++ )
{
	if (C[i] > 100)
	{
		if(C[i] < the_lowest_value_above_100)
		{
			the_lowest_value_above_100 = C[i];
		}
	}
}

Once again zero loop required but just few lines of array processing.

condition = C > 100;
spcomp = SparseCompress(condition, C);
	llc = Lowest(spcomp);
spexp = SparseExpand(condition, llc);

Plot( C, "Price", colorDefault, styleBar );
Plot( spexp, "llc", colorRed );

BTW read here for further help in future

3 Likes