Indicator · Pine Script v5 · Own pane

Percent Rank

by regalouisei· code credited to VanHe1sing

The Percent Rank indicator plots the percent rank of closing prices for ten different cryptocurrency symbols in columns within a separate pane.

View on GitHub

GitHub stars2on the repository
Pine versionv5runs as is
Lines of code126
Settings12inputs
LicenceNone statedfile: MPL-2.0
Last update8 months ago25 Feb 2026

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.

Source Code

126 lines of Pine Script v5 from pinescript/editors_picks/percent-rank-histogram.pine, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.

percent-rank-histogram.pine
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © VanHe1sing

//@version=5
indicator("Percent Rank",  shorttitle = "PR% ▲▼",overlay = false, max_lines_count = 72, max_labels_count = 15)

int length = input.int(60, title='Percent Rank Length', tooltip = "Percent rank is the percents of how many 
                             previous values was less than or equal to the current value of given series."
                             , group = "Percent Rank")

columns_width = 30-input.int(15, "Columns Width", minval = 10, maxval = 20)

 // Symbol's //
symbol1  = input.symbol("CRYPTOCAP:TOTAL", "Ticker 1", group = "Ticker")
symbol2 = input.symbol("BTCUSD", "Ticker 2", group = "Ticker")
symbol3 = input.symbol("ETHUSD", "Ticker 3", group = "Ticker")
symbol4 = input.symbol("BNBUSD", "Ticker 4", group = "Ticker")
symbol5 = input.symbol("SOLUSD", "Ticker 5", group = "Ticker")
symbol6 = input.symbol("XRPUSD", "Ticker 6", group = "Ticker")
symbol7 = input.symbol("ADAUSD", "Ticker 7", group = "Ticker")
symbol8 = input.symbol("AVAXUSD","Ticker 8", group = "Ticker")
symbol9 = input.symbol("DOGEUSD","Ticker 9", group = "Ticker")
symbol10= input.symbol("LINKUSD","Ticker 10",group = "Ticker")

// Request source with percentrank and colors//
request(symbol)=>
    p = request.security(symbol, "", ta.percentrank(close, length))
    c = color.from_gradient(p, 0, 100, color.red, color.green)
    [p, c]

// Draw Columns //
column(index, width, src, color)=>
    _1_ = chart.point.from_index(bar_index-index, math.round(src))
    _2_ = chart.point.from_index(bar_index-index, 0)

    for i = 2 to 8
        line.new(_1_, _2_, width = width*i, color = color.new(color, columns_width*i))


// Draw desk and Scales //
d_s()=>
    // Desk and Scale Chart Points
    bar_back = 265
    _1_1 = chart.point.from_index(bar_index, -2)
    _1_2 = chart.point.from_index(bar_index-bar_back, -2)

    _2_1 = chart.point.from_index(bar_index-6, 2)
    _2_2 = chart.point.from_index(bar_index-bar_back-6, 2)

    _3_1 = chart.point.from_index(bar_index-bar_back, -2)
    _3_2 = chart.point.from_index(bar_index-bar_back-6, 2)

    _4_1 = chart.point.from_index(bar_index, -2)
    _4_2 = chart.point.from_index(bar_index-6, 2)
    // Desk 
    d_color = color.white
    l1 = line.new(_1_1, _1_2, width = 3, color = color.gray)
    l2 = line.new(_2_1, _2_2, width = 1, color = d_color)
    line.new(_3_1, _3_2, width = 3, color = color.gray)
    line.new(_4_1, _4_2, width = 1, color = d_color)

    linefill.new(l1, l2, d_color)

    // Scale Lines 
    mid_1 = chart.point.from_index(bar_index-6, 50)
    mid_2 = chart.point.from_index(bar_index-bar_back-6, 50)
    hi_1  = chart.point.from_index(bar_index-6, 100)
    hi_2  = chart.point.from_index(bar_index-bar_back-6, 100)

    lm1   = line.new(mid_1, mid_2, width = 1, color = color.gray)
    lh1   = line.new(hi_1,   hi_2, width = 1, color = color.white)
    linefill.new(lm1, lh1, #23432423)
    linefill.new(lm1, l2, #43232323)

// Draw label //
lbl(index, symbol, pr)=>
    sym = str.split(symbol, ":")
    label.new(bar_index-index, 0, sym.get(1), 
                         style = label.style_label_upper_left, textcolor = color.white, color = color.rgb(72, 74, 82))

    p_r =  ta.change(pr, length>=50 ? 50 : length) >= 0 ? 
           str.tostring(math.round(pr))+"% ▲"
         : str.tostring(math.round(pr))+"% ▼"
    color = pr > 50 ? color.rgb(172, 247, 174) : color.rgb(243, 174, 174)
    label.new(bar_index-index, pr, p_r, style = label.style_none, textcolor = color)

// Request Tickers and Colors //
[pr_1, color1] = request(symbol1)
[pr_2, color2] = request(symbol2)
[pr_3, color3] = request(symbol3)
[pr_4, color4] = request(symbol4)
[pr_5, color5] = request(symbol5)
[pr_6, color6] = request(symbol6)
[pr_7, color7] = request(symbol7)
[pr_8, color8] = request(symbol8)
[pr_9, color9] = request(symbol9)
[pr_10,color10] = request(symbol10)

// Plot //
if barstate.islast
    d_s()
    index = 25
    column(index,  10,pr_1, color1)
    column(index*2, 8,pr_2, color2)
    column(index*3, 8,pr_3, color3)
    column(index*4, 8,pr_4, color4)
    column(index*5, 8,pr_5, color5)
    column(index*6, 8,pr_6, color6)
    column(index*7, 8,pr_7, color7)
    column(index*8, 8,pr_8, color8)
    column(index*9, 8,pr_9, color9)
    column(index*10,8,pr_10,color10)

    // Labels
    lbl(index,   symbol1, pr_1)
    lbl(index*2, symbol2, pr_2)
    lbl(index*3, symbol3, pr_3)
    lbl(index*4, symbol4, pr_4)
    lbl(index*5, symbol5, pr_5)
    lbl(index*6, symbol6, pr_6)
    lbl(index*7, symbol7, pr_7)
    lbl(index*8, symbol8, pr_8)
    lbl(index*9, symbol9, pr_9)
    lbl(index*10,symbol10,pr_10)

// ▼▲ //

Overview

Percent Rank calculates the rank relative to previous values over a user-defined length period, defaulting to 60 bars. Columns are drawn using lines at varying heights with colors transitioning from red to green as the rank increases. A reference desk and scale lines are included at the top. The main settings allow adjustment of the percent rank length and columns width. The script uses multiple input symbols and request.security for data retrieval.

Details

Published by

regalouisei on GitHub

Code credit

VanHe1sing, as written in the script's header

Type

Indicator, Pine Script v5

Draws

Separate pane below the chart

Category

Oscillators & momentum, Support & resistance

Markets

Crypto

Timeframes

Any timeframe

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
Percent Rank Lengthint60length
Columns Widthint15Columns Width
Ticker 1symbolCRYPTOCAP:TOTALsymbol1
Ticker 2symbolBTCUSDsymbol2
Ticker 3symbolETHUSDsymbol3
Ticker 4symbolBNBUSDsymbol4
Ticker 5symbolSOLUSDsymbol5
Ticker 6symbolXRPUSDsymbol6
Ticker 7symbolADAUSDsymbol7
Ticker 8symbolAVAXUSDsymbol8
Ticker 9symbolDOGEUSDsymbol9
Ticker 10symbolLINKUSDsymbol10
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.

Similar Pine Scripts

114 stars

This indicator combines a scaled Forecast Oscillator with a Point of Force state detector. The Forecast Oscillator calculates the percentage deviation of price from its linear regression curve and normalizes the output between 0 and 1, plotting a line in a sep

Indicator v4 Oscillators & momentumSupport & resistance Repaints

CCI DC

by be-thomas
65 stars

This indicator plots the Commodity Channel Index in a separate pane and surrounds it with a Donchian channel whose lookback length changes with volatility. It measures volatility as a ratio of short and long ATR values, then ranks that ratio and shortens or le

Indicator v5 Oscillators & momentumVolatility & bands
Updated 4 days ago · GPL-3.0 GitHub repository of CCI DC

WaveTrend 3D

by nersent
29 stars

WaveTrend 3D is a redesigned oscillator that implements the classic WaveTrend algorithm with kernel-based regression for trend reversal confirmation and multi-timeframe support. It calculates a smoothed oscillator line and displays a symmetrical three-dimensio

Indicator v5 Oscillators & momentumDivergence
Updated 11 months ago · Custom licence GitHub repository of WaveTrend 3D

Benso Pendulum

by benso87
24 stars

Benso Pendulum is an indicator that plots a customizable Relative Strength Index (RSI) oscillator in a separate pane on the price chart. It calculates the RSI using the specified source and period, applying dynamic colors that change based on overbought and ov

Indicator v5 Oscillators & momentumSupport & resistance
Updated 4 years ago · MPL-2.0 GitHub repository of Benso Pendulum
9 stars

This indicator plots currency strength values for EUR, USD, JPY, GBP, CHF, AUD, CAD, NZD and optionally XAU or XAG on a separate pane. It computes strength by comparing current pair closes to daily closes using broker-specific data from OANDA, FX or FOREXCOM.

Indicator v4 Oscillators & momentumSupport & resistance Repaints
Updated 5 years ago · None stated GitHub repository of 4th Dimension Currency Strength

More indicators

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers