Indicator · Pine Script v4 · Own pane

Tables-003 Oscillator Distribution

by ricardosantos79· code credited to RicardoSantos

This indicator plots the RSI oscillator on the main chart and displays its value distribution in a table positioned at the top right.

View on GitHub

GitHub stars261on the repository
Pine versionv4older, still runs
Lines of code43
Settings3inputs
LicenceNone statedfile: MPL-2.0
Last update4 years ago13 Nov 2021

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

43 lines of Pine Script v4 from beta/tables/tables-003-oscilator_distribution.pinescript, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.

tables-003-oscilator_distribution.pinescript
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © RicardoSantos

//@version=4
study(title="tables-003-oscilator_distribution")

float rsi_src = input(close)
int rsi_length = input(14)
float rsi = rsi(rsi_src, rsi_length)

hline(0)
hline(50)
hline(100)
plot(rsi)
 
color c_tb_bg = color.new(color.black, 100)
float i_cl_height = input(0.5)
var int[] distribution = array.new_int(100, 0)

var T = table.new(position=position.top_right, 
     rows=100, columns=100, bgcolor=c_tb_bg, 
     frame_color=color.black, frame_width=0, 
     border_color=color.black, border_width=0)
 
if bar_index > rsi_length
    int _rsi_index = round(rsi)

    array.set(distribution, _rsi_index, array.get(distribution, _rsi_index) + 1)
    int _total = array.sum(distribution)

    for _r = 0 to 99
        for _c = 0 to 99
            int _dist_value = round(array.get(distribution, _r) / _total * 100)
            if _c > _dist_value 
                table.cell(table_id=T,
                     column=99-_c, row=99-_r, text='',
                     width=0.0, height=i_cl_height, 
                     text_color=color.white, text_halign=text.align_center, bgcolor=c_tb_bg)
            else
                table.cell(table_id=T,
                     column=99-_c, row=99-_r, text='',
                     width=1.0, height=i_cl_height, 
                     text_color=color.white, text_halign=text.align_center, bgcolor=color.blue)

Overview

The script calculates the relative strength index using the input source and length, then plots horizontal lines at 0, 50, and 100. It maintains an array to track the frequency of each RSI value encountered on bars after the length period. A table is updated each bar to show the proportional distribution of RSI values, with blue cells indicating higher counts and white cells for lower ones. The table height can be adjusted via input. It draws on the price chart with the RSI plot and the distribution table. This is a visual tool for observing RSI value frequencies over time, without any buy or sell signals or exit rules.

Details

Published by

ricardosantos79 on GitHub

Code credit

RicardoSantos, as written in the script's header

Type

Indicator, Pine Script v4

Draws

Separate pane below the chart

Category

Oscillators & momentum, Screeners & dashboards

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.

Settings

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

SettingTypeDefaultVariable
rsi_srcsourceclosersi_src
rsi_lengthint14rsi_length
i_cl_heightfloat0.5i_cl_height
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

This indicator scans a pasted list of symbols for RSI directional momentum and shows matching long and short signals in a table in a separate pane. The user chooses continuous break, continuous retracement, flip break, flip retracement, divergence, or hidden d

Indicator v6 Oscillators & momentumDivergence
Updated 1 year ago · MPL-2.0 GitHub repository of Momentum Setup - RSI Directional Momentum Scanner

Market Speedometer

by TradersPost
218 stars

Market Speedometer plots a 0-100 market speed reading in a separate pane. It measures movement by bar-to-bar change, true range, or a short average of recent bars, then ranks that movement against ATR and a percentile lookback. An EMA smooths the reading, and

Indicator v6 Volatility & bandsOscillators & momentum
Updated 3 months ago · None stated GitHub repository of Market Speedometer

KamaFama

by Mastaaa1987
141 stars

KamaFama is an indicator that translates a Freqtrade trading strategy into Pine Script for visualization. It combines Kaufman Adaptive Moving Average (KAMA), MAMA/FAMA calculations derived via Hilbert Transform, Williams %R, and correlation trend filters to ev

Indicator v6 Moving averagesOscillators & momentum
Updated 6 weeks ago · MIT GitHub repository of KamaFama
114 stars

Calculates normalized reversal metrics across up to ten Forex currency pairs using user-selected moving average methods, including HarmonicMA, EMA, SMA, or WMA. The indicator identifies overbought, oversold, and mean-crossing conditions using a configurable th

Indicator v4 Screeners & dashboardsMean reversion
Updated 1 year ago · None stated GitHub repository of Multi-Pair Trend Reversal Widget

Oscillator Suite

by TamaraKGreen
46 stars

Oscillator Suite plots a normalised price oscillator in a separate pane and overlays a signal line that can use SMA, EMA, WMA, HMA, RMA, VWMA, T3, ZEMA, KAMA, or GKEMA. It marks bullish and bearish divergences, a smoothed money-flow series, confluence areas an

Indicator v5 Oscillators & momentumDivergence
Updated 7 weeks ago · None stated GitHub repository of Oscillator Suite

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