Lipi Reference
Lipi

Functions

array.percentrank()

Returns the percentile rank of the element at `index`: the percentage of elements that are less than or equal to it.

Syntax

                array.percentrank(series array id, series int index) → series float
              

Arguments

id required series array
index required series int

Return Type

series float

Example


          //@lipi=2
indicator("array.percentrank Example", overlay=false)
static array<float> closes = array.new_float(50, close)
array.shift(closes)
array.push(closes, close)
// Where does the latest close rank among the last 50?
plot(array.percentrank(closes, array.length(closes) - 1), title="Percent Rank", color=color.blue)