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 The series to take the percentile of.
length required series int How many bars the window covers.
percentile required series float The percentile wanted. Int or float.

Return Type

series float

Example


          indicator("Percentile Linear Interpolation", overlay=true)
length = input(20, "Lookback Period")
percentile = input(75, "Percentile")
source = input(hlc3, "Source")
percentileValue = ta.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")