Hello, The following code will find the highest close in the last 100 bars: highest (close, 100) What code is needed to find the next highest close? Norm
Norm, I think you need a dynamic array. I've used this code in similar studies. input: Nth(2), Len(100); var: ix(0); array: HArray[](0); Array_SetMaxIndex(hi, len); for ix = 0 to len -1 begin HiArray[ix]=h[ix]; end; value1 = Array_Sort(hi, 0, len-1, false); { value1 returns a "1" so it does not get used to find what you want. To get the nth highest value in the array, in this case, the last "len" highs, it is: HArray[2]. } The nth highest is HArray[nth]. The highest is HArray[1]. DS