ta.percentile_nearest_rank()
Percentile (Nearest Rank)
Calculates the percentile using the nearest rank method.
Syntax
ta.percentile_nearest_rank(source, length, percentage) → series floatArguments
| Parameter | Type | Description |
|---|---|---|
| source | series int/float | Series of values to process. |
| length | series int | Number of bars in the rolling window. |
| percentage | simple int/float | Target percentile in the 0-100 range. |
Returns
P-th percentile of source for length bars back using nearest rank method.
Remarks
na values in the source series are ignored.
Code Examples
//@version=6
indicator("percentile_nearest_rank")
plot(ta.percentile_nearest_rank(high, 50, 90), title="90th pct high")Trading Applications
Calculate percentile levels using nearest rank method
Build percentile-based channel indicators
Identify extreme price levels statistically
Create robust outlier detection systems
Related Functions
Frequently Asked Questions
Generate ta.percentile_nearest_rank() Code with AI
Skip the manual coding. Use Pineify's AI Coding Agent to generate Pine Script code using ta.percentile_nearest_rank() and other built-in functions instantly.
Related Pine Script Functions
ta.percentile_linear_interpolation()
Learn how to use ta.percentile_linear_interpolation() in Pine Script. Calculate percentiles using linear interpolation.
ta.percentrank() - Percent Rank
Learn how to use ta.percentrank() in Pine Script. Calculate percentile ranking of current value.
ta.median() - Median
Learn how to use ta.median() in Pine Script. Calculate the median value for robust price analysis.
ta.stdev() - Standard Deviation
Learn how to use ta.stdev() in Pine Script. Syntax, parameters, code examples for statistical standard deviation calculation.
ta.variance() - Variance
Learn how to use ta.variance() in Pine Script. Calculate statistical variance for volatility analysis.