Docs

ta.percentile_linear_interpolation

Read a percentile of the window, interpolating between the two nearest ranks.

itm
ta.percentile_linear_interpolation(source, length, percentage, min=length)

Window percentile by linear interpolation: sort the last length observations ascending and read position percentage/100 * (length - 1), counted from 0, interpolating linearly between the two ranks it falls between. percentage = 50 is therefore exactly ta.median, including the average of the two middle values on an even length. ta.percentile is the same operator under the shorter name.

Parameters

A series parameter takes a value on every bar. A constant parameter must be known before the first bar, such as a number or an input.

NameKindTypeDefaultRangeDescription
sourceSeriesnumber--The series to read.
lengthConstantnumber-1 to 10000Window in observed bars.
percentageConstantnumber500 to 100Which percentile to take, 0 to 100. 50 is the median.
minConstantnumber-1 to 10000Valid values the window must hold before it reports (an option, written min=15). An na is skipped. Absent = length: the window must be full and gap-free.

Output

NameType
valuenumber

Warm-up and missing values

Warm-up
length bars. Names in the warm-up are this operator’s parameters.
Missing values
Returns na until length consecutive non-na observations are in the window. An na resets the accumulation. With min=, an na is skipped and the value is taken over the valid observations once there are at least min of them.

Example

itm
ta.percentile_linear_interpolation(close, 20, 50)
itm
plot(ta.percentile_linear_interpolation(close, 20, 90), "Ninetieth 20")