ta.percentrank()
Percent Rank
Percent rank is the percentage of how many previous values were less than or equal to the current value of a given series.
Syntax
ta.percentrank(source, length) → series floatArguments
| Parameter | Type | Description |
|---|---|---|
| source | series int/float | Series of values to process. |
| length | series int | Number of bars in the rolling window. |
Returns
Percent rank of source for length bars back.
Remarks
na values in the source series are ignored.
Code Examples
//@version=6
indicator("ta.percentrank")
plot(ta.percentrank(close, 50))Trading Applications
Rank current value relative to historical values
Identify extreme readings for mean reversion
Build percentile-based trading signals
Normalize indicators across different securities
Related Functions
Frequently Asked Questions
Generate ta.percentrank() Code with AI
Skip the manual coding. Use Pineify's AI Coding Agent to generate Pine Script code using ta.percentrank() 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.percentile_nearest_rank()
Learn how to use ta.percentile_nearest_rank() in Pine Script. Calculate percentiles using nearest rank method.
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.rsi() - Relative Strength Index
Learn how to use ta.rsi() in Pine Script. Syntax, parameters, code examples for the RSI momentum oscillator.