Lipi Reference
Lipi

Functions

talib.percentile_nearest_rank()

Takes the requested `percentile` of `source` over `length` bars at the nearest rank, without interpolating. The result is therefore one of the values in the window. Where you would rather have a smoother figure, use the linear-interpolation function.

Syntax

                talib.percentile_nearest_rank(series float source, series int length, series float percentile) → series float
              

Arguments

source required series float Series of values to process (source).
length required series int Number of bars back (length).
percentile required series float Percentage, a number from range 0..100.

Return Type

series float

Example


          //@lipi=2
indicator("Percentile Linear Interpolation", overlay=true)
length = input(20, "Lookback Period")
percentile = input(75, "Percentile")
source = input(hlc3, "Source")
percentileValue = talib.percentile_linear_interpolation(source, length, percentile)
plot(percentileValue, color=color.blue, title="75th Percentile", linewidth=2)
plot(close, color=color.gray, style=plotStyle.scatter, title="Price")
plot(percentileValue, color=color.blue, title="75th Percentile")