StatisticalPine Script v6

ta.percentile_linear_interpolation()

Percentile (Linear Interpolation)

Calculates the percentile using linear interpolation between the two nearest ranks.

Syntax

Syntax
ta.percentile_linear_interpolation(source, length, percentage) → series float

Arguments

ParameterTypeDescription
sourceseries int/floatSeries of values to process.
lengthseries intNumber of bars in the rolling window.
percentagesimple int/floatTarget percentile in the 0-100 range.

Returns

P-th percentile of source for length bars back using linear interpolation.

Remarks

na values in the source series are ignored.

Code Examples

Pine Script v6 Example
//@version=6
indicator("percentile_linear_interpolation")
p50 = ta.percentile_linear_interpolation(close, 100, 50)
plot(p50, title="Median-like (50th pct)")

Trading Applications

Calculate precise percentile levels for price analysis

Build adaptive bands based on percentile levels

Create dynamic support/resistance from statistical distributions

Use for non-parametric volatility measurement

Frequently Asked Questions

Generate ta.percentile_linear_interpolation() Code with AI

Skip the manual coding. Use Pineify's AI Coding Agent to generate Pine Script code using ta.percentile_linear_interpolation() and other built-in functions instantly.