# Function for finding the 'N'th highest price in M days

Questions about MultiCharts and user contributed studies.
steven
Posts: 37
Joined: 07 Jun 2010
Location: china
Has thanked: 2 times
Contact:

### Function for finding the 'N'th highest price in M days

Hi, Is there any function for finding the 'N'th highest price in M days?

Steven

TJ
Posts: 6874
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 984 times
Been thanked: 1976 times

### Re: Function for finding the 'N'th highest price in M days

steven wrote:Hi, Is there any function for finding the 'N'th highest price in M days?

Steven

can you post a diagram to illustrate?

steven
Posts: 37
Joined: 07 Jun 2010
Location: china
Has thanked: 2 times
Contact:

### Re: Function for finding the 'N'th highest price in M days

Hi TJ,

For example, we have a function named highest(c, n) which will show the highest close of N bars, My question is: have we had another function which will show the second highest close of N bars, like highest2(c,n,2).

Steven

CrazyNasdaq
Posts: 270
Joined: 02 Sep 2009
Location: ITALY
Has thanked: 79 times
Been thanked: 80 times

### Re: Function for finding the 'N'th highest price in M days

steven wrote:Hi TJ,

For example, we have a function named highest(c, n) which will show the highest close of N bars, My question is: have we had another function which will show the second highest close of N bars, like highest2(c,n,2).

Steven

Hi Steven,

You have to create an array with N Highest close and then sort them to have the second N highest close. In this way you can have all the N highest close from the first to the last, ordered and you can retrive them. You can do this with all the quotes you need, close, high, low, volume, range and so on.

steven
Posts: 37
Joined: 07 Jun 2010
Location: china
Has thanked: 2 times
Contact:

### Re: Function for finding the 'N'th highest price in M days

Got it, Thanks CrazyNasdaq and TJ.

Steve

CrazyNasdaq
Posts: 270
Joined: 02 Sep 2009
Location: ITALY
Has thanked: 79 times
Been thanked: 80 times

### Re: Function for finding the 'N'th highest price in M days

steven wrote:Got it, Thanks CrazyNasdaq and TJ.

Steve

You are welcome Steve.