@Gloriafilamino there are several posts on the forum that help with finding the order or sorting the order of an array. For example,

There is a similar post for the Nth highest (search the forum). But we can use the above function for your case too.

```
///@link https://forum.amibroker.com/t/function-of-nth-lowest-function-in-afl/6522/2
nBars = Param("nBars", 5, 1, 10, 1);
PriceArray = Close;
function NthLowest( array, nBars, Nth )
{
return Percentile( array, nBars, 100 * (Nth-1) / ( nBars - 1 ) );
}
// examples, this can be put into a loop for additional flexibility
rank1 = 1;
rank2 = 2;
rank3 = 3;
rank4 = 4;
rank5 = 5;
// HighestValue2 = HHV( PriceArray, nBars ); // a simple method for finding the highest value
HighestValue = NthLowest( PriceArray, nBars, rank5);
SecondHighest = NthLowest( PriceArray, nBars, rank4);
ThirdHighest = NthLowest( PriceArray, nBars, rank3);
FourthHighest = NthLowest( PriceArray, nBars, rank2);
FifthHighest = NthLowest( PriceArray, nBars, rank1);
// FifthHighest2 = LLV( PriceArray, nBars ); // a simple method for finding the lowest value
```