Functions
talib.percentrank()
Ranks where `source` now stands against the last `length` bars of itself. It answers the question the other way round from the percentile functions: they take a rank and give a value, this takes the value and gives its rank.
Syntax
talib.percentrank(series float source, series int length) → series float
Arguments
source required series float The series being ranked. length required series int How many bars the ranking covers. Return Type
series float Example
indicator("Percent Rank", overlay=false)
length = input(20, "Lookback Period")
source = input(close, "Source")
percentRank = talib.percentrank(source, length) * 100
plot(percentRank, color=color.blue, title="Percent Rank")
hline(80, "Overbought", color=color.red)
hline(20, "Oversold", color=color.green)