Indicator · Pine Script v6 · Own pane

RSI + Relative Liquidity Index

by InNoobWeTrust

This indicator calculates both a standard Relative Strength Index and a Relative Liquidity Index, which applies an RSI calculation to Average True Range values.

View on GitHub

GitHub stars4on the repository
Pine versionv6current
Lines of code151
Settings19inputs
LicenceNone statedfile: MPL-2.0
Last updatetoday28 Oct 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

151 lines of Pine Script v6 from .innoobwetrust/life_hacks/tradingview/rsi_and_relative_liquidity_index.pine, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.

rsi_and_relative_liquidity_index.pine
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © InNoobWeTrust

//@version=6
indicator("RSI + Relative Liquidity Index",max_bars_back = 3600, overlay = false)

//===============================================================================
// Types
//===============================================================================
enum MaT
    sma = 'SMA'
    wma = 'WMA'
    ema = 'ema'

type ClimaxCandle
    float o // open price
    float h // high price
    float l // low price
    float c // close price
    int b_idx // bar index
    color clr // color
    line h_line_plt // drawing of high price
    line l_line_plt // drawing of low price
    linefill fill_between_plt // fill between high and low
//===============================================================================
// Functions
//===============================================================================
ma(MaT t, src, int len) =>
    switch t
        MaT.sma => ta.sma(src,len)
        MaT.wma => ta.wma(src,len)
        MaT.ema => ta.ema(src,len)

relative_liquidity_index(int atr_len, int rli_len) =>
    atr = ta.atr(atr_len)
    rli = ta.rsi(atr,rli_len)
    // Return the RLI
    rli

climax_candle_from_history(int bar_idx, color clr, int extend_bars) =>
    bars_back = bar_index - bar_idx
    o = close[bars_back]
    h = high[bars_back]
    l = low[bars_back]
    c = low[bars_back]
    h_line_plt = line.new(bar_idx,h,bar_idx + extend_bars,h,color=clr,force_overlay = true)
    l_line_plt = line.new(bar_idx,l,bar_idx + extend_bars,l,color=clr,force_overlay = true)
    fill_between_plt = linefill.new(h_line_plt,l_line_plt,clr)
    // Return the candle
    ClimaxCandle.new(o,h,l,c,bar_idx,clr,h_line_plt,l_line_plt,fill_between_plt)

clean_candle_drawing(ClimaxCandle candle) =>
    linefill.delete(candle.fill_between_plt)
    line.delete(candle.h_line_plt)
    line.delete(candle.l_line_plt)

//===============================================================================
// Input
//===============================================================================
threshold_grp = '► Thresholds'
index_low_threshold = input.float(30,'Low threshold',minval=0,maxval=50,group = threshold_grp)
index_high_threshold = input.float(70,'High threshold',minval=50,maxval=100,group = threshold_grp)

rsi_grp = '► RSI'
rsi_src = input.source(close,'RSI source',group = rsi_grp)
rsi_len = input.int(14,'RSI length',group = rsi_grp)
rsi_ma_inline = 'RSI MA'
rsi_ma_type = input.enum(MaT.sma,rsi_ma_inline,group = rsi_grp,inline = rsi_ma_inline)
rsi_ma_len = input.int(14,'',group = rsi_grp,inline = rsi_ma_inline)
oversold_color = input.color(color.new(color.green,50),'Oversold area color',group = rsi_grp)
overbought_color = input.color(color.new(color.red,50),'Overbought area color',group = rsi_grp)

liquidity_grp = '► Liquidity'
atr_len = input.int(34,'ATR length',group = liquidity_grp)
rli_len = input.int(14,'Relative Liquidity Index length',group = liquidity_grp)
low_liquidity_color = input.color(color.new(color.maroon,80),'Low liquidity area color',group = liquidity_grp)
high_liquidity_color = input.color(color.new(color.teal,80),'High liquidity area color',group = liquidity_grp)
show_chart_background = input.bool(true,'Show gradient background on chart',group = liquidity_grp)
no_background_till_thresholds = input.bool(true, "No background color until threshold exceeded", group = liquidity_grp)

climax_candle_grp = '► Climax candle'
climax_candle_enable = input.bool(true,'Enable',tooltip = 'Highlight price ranges of candles that reach highest/lowest point during high liquidity zones',group = climax_candle_grp)
climax_candle_max_zones = input.int(25,'Max zones',group = climax_candle_grp)
climax_candle_max_extend = input.int(258,'Max bars to extend zones',group = climax_candle_grp)
climax_candle_zone_color_inline = 'Zone colors (low/high swing)'
climax_candle_zone_low_color = input.color(color.new(color.red,90),climax_candle_zone_color_inline,group = climax_candle_grp,inline = climax_candle_zone_color_inline)
climax_candle_zone_high_color = input.color(color.new(color.green,90),'',group = climax_candle_grp,inline = climax_candle_zone_color_inline)
//===============================================================================
// Calculation
//===============================================================================

// RSI
rsi = ta.rsi(rsi_src,rsi_len)
rsi_ma = ma(rsi_ma_type,rsi,rsi_ma_len)
oversold_area_color = rsi <= index_low_threshold ? oversold_color : na
overbought_area_color = rsi >= index_high_threshold ? overbought_color : na

// RLI
rli = relative_liquidity_index(atr_len,rli_len)
low_liquidity_area_color = rli <= index_low_threshold ? low_liquidity_color : na
high_liquidity_area_color = rli >= index_high_threshold ? high_liquidity_color : na
rli_color = color.from_gradient(rli,0,100,low_liquidity_color,high_liquidity_color)
rli_bg_color = not no_background_till_thresholds or (rli <= index_low_threshold or rli >= index_high_threshold) ? rli_color : color(na)

// Climax candles
var ClimaxCandle[] candles = array.new<ClimaxCandle>()
var int last_cross_middle = 0
// liquidity_crossunder_low = ta.crossunder(rli,index_low_threshold)
// liquidity_crossover_low = ta.crossover(rli,index_low_threshold)
// liquidity_crossover_high = ta.crossover(rli,index_high_threshold)
liquidity_crossunder_high = ta.crossunder(rli,index_high_threshold)
liquidity_cross_middle = ta.cross(rli,50)

if liquidity_cross_middle
    last_cross_middle := bar_index

pivot_high = ta.pivothigh(math.max(bar_index - last_cross_middle,1),0)
pivot_high_idx = ta.valuewhen(not na(pivot_high),bar_index,0)
pivot_low = ta.pivotlow(math.max(bar_index - last_cross_middle,1),0)
pivot_low_idx = ta.valuewhen(not na(pivot_low),bar_index,0)
avg_rsi_ma = ta.sma(rsi_ma,math.max(bar_index - last_cross_middle,1))

if climax_candle_enable and barstate.isconfirmed and liquidity_crossunder_high
    candle_idx = avg_rsi_ma >= 50 ? pivot_high_idx : pivot_low_idx
    clr = avg_rsi_ma >= 50 ? climax_candle_zone_low_color : climax_candle_zone_high_color
    candles.push(climax_candle_from_history(candle_idx,clr,climax_candle_max_extend))

// Prune old candles
while candles.size() > climax_candle_max_zones
    clean_candle_drawing(candles.first())
    candles.shift()
//===============================================================================
// Plot
//===============================================================================
// Thesholds
hline(index_low_threshold,'Index Low threshold',linestyle = hline.style_dashed,color=color.new(color.gray,50))
hline(50,'Index Middle',linestyle = hline.style_dashed,color=color.new(color.gray,50))
hline(index_high_threshold,'Index High threshold',linestyle = hline.style_dashed,color=color.new(color.gray,50))

// RSI
plot(rsi,'RSI',color.purple,force_overlay = false)
plot(rsi_ma,'RSI MA', color.yellow,force_overlay = false)
plot(rsi,'Oversold',oversold_area_color,style = plot.style_area,histbase = index_low_threshold)
plot(rsi,'Overbought',overbought_area_color,style = plot.style_area,histbase = index_high_threshold)

// RLI
plot(rli, 'Relative Liquidity Index',color = color.new(rli_color,0),linewidth = 2,force_overlay = false)
plot(rli,'Time of low liquidity',low_liquidity_area_color,style = plot.style_area,histbase = index_low_threshold)
plot(rli,'Time of high liquidity',high_liquidity_area_color,style = plot.style_area,histbase = index_high_threshold)

bgcolor(show_chart_background ? rli_bg_color : color(na),force_overlay = true)

Overview

RSI + Relative Liquidity Index plots these oscillators in a separate pane alongside overbought and oversold threshold levels. It can also project historical climax candle price zones onto the main chart using line fills. Key settings allow customization of RSI and ATR lengths, moving average smoothing choices, threshold levels, and chart background gradients.

Details

Published by

InNoobWeTrust on GitHub

Type

Indicator, Pine Script v6

Draws

Separate pane below the chart

Category

Oscillators & momentum, Volatility & bands, Support & resistance

Markets

Any symbol

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.

Topics

dotfiles

Settings

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

SettingTypeDefaultVariable
Low thresholdfloat30index_low_threshold
High thresholdfloat70index_high_threshold
RSI sourcesourceclosersi_src
RSI lengthint14rsi_len
rsi_ma_typeenumMaT.smarsi_ma_type
rsi_ma_lenint14rsi_ma_len
Oversold area colorcolorcolor.new(color.green,50)oversold_color
Overbought area colorcolorcolor.new(color.red,50)overbought_color
ATR lengthint34atr_len
Relative Liquidity Index lengthint14rli_len
Low liquidity area colorcolorcolor.new(color.maroon,80)low_liquidity_color
High liquidity area colorcolorcolor.new(color.teal,80)high_liquidity_color
Show all 19 settings
SettingTypeDefaultVariable
Show gradient background on chartbooltrueshow_chart_background
No background color until threshold exceededbooltrueno_background_till_thresholds
Enablebooltrueclimax_candle_enable
Max zonesint25climax_candle_max_zones
Max bars to extend zonesint258climax_candle_max_extend
climax_candle_zone_low_colorcolorcolor.new(color.red,90)climax_candle_zone_low_color
climax_candle_zone_high_colorcolorcolor.new(color.green,90)climax_candle_zone_high_color
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

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

Market Pressure Scale plots two oscillator curves in a separate pane. Setup pressure combines ATR and Bollinger compression, support and resistance proximity, and drying volume. Impulse pressure combines range expansion, volume, and candle body size. A range-c

Indicator v6 Oscillators & momentumVolatility & bands
Updated yesterday · MIT GitHub repository of Market Pressure Scale [WavesUnchained]

QFA Pro Elite Refined

by JasonTeixeira
9 stars

This indicator plots a smoothed fear index in a separate pane. It measures how far the current low sits below the highest close over a lookback, scales that reading by an ATR percentile, and smooths it with a zero-lag EMA. A volatility regime raises or lowers

Indicator v6 Oscillators & momentumVolatility & bands
Updated 12 days ago · Custom licence GitHub repository of QFA Pro Elite Refined
7 stars

Range Oscillator (Zeiierman) plots a range-based oscillator in a separate pane. It qualifies a range box from a minimum number of bars and sizes that box vertically with an ATR width multiplier. A heatmap splits the recent high-low span into horizontal levels

Indicator v6 Oscillators & momentumVolatility & bands
Updated 3 months ago · None stated GitHub repository of Range Oscillator (Zeiierman)

MACD Breakout

by jerryinyang
5 stars

This indicator plots a higher-timeframe MACD breakout setup on the price chart and combines it with linear regression channels. It marks support and resistance zones from MACD histogram sensitivity, then filters them with the MACD zero line, a linear regressio

Indicator v4 Oscillators & momentumBreakout
Updated 2 years ago · None stated GitHub repository of MACD Breakout
4 stars

This indicator is a live strategy scanner for cryptocurrency pairs. It runs six strategies on the current chart, tracks their wins and losses, and rates them to show the best one for this pair and timeframe. It uses ATR for adaptive TP/SL, auto-scales based on

Indicator v5 Oscillators & momentumVolatility & bands

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