Indicator · Pine Script v4 · On the chart

Tables

by Web3Degenerate· code credited to ZenAndTheArtOfTrading / www.PineScriptMastery.com

Calculates real-time price and technical metrics and displays them in a table on the top right of the chart.

View on GitHub

GitHub stars2on the repository
Pine versionv4older, still runs
Lines of code34
Settings0inputs
LicenceNone statedfile: MPL-2.0
Last update2 years ago13 Sep 2024

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

34 lines of Pine Script v4 from advanced-pine-script/16.Bonus-V4-Content/11.Using-Tables-To-Display-Data.pine, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.

11.Using-Tables-To-Display-Data.pine
//This demonstrates how to use tables to display data onto your charts.

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © ZenAndTheArtOfTrading / www.PineScriptMastery.com
// @version=4
study("Tables", overlay=true)

// Custom function to truncate (cut) excess decimal places
truncate(_number, _decimalPlaces) =>
    _factor = pow(10, _decimalPlaces)
    int(_number * _factor) / _factor

// Get display data
ema = ema(close,50)
rsi = rsi(close,14)
mktChange = (change(close) / close[1]) * 100

// Create table
var table myTable = table.new(position.top_right, 5, 2, border_width=1)

// Update table
if barstate.islast
    txt1 = "Closing Price\n" + tostring(close)
    txt2 = "Opening Price\n" + tostring(open)
    txt3 = "Pip Gain/Loss\n" + tostring(close - open)
    txt4 = "50-EMA Value\n" + tostring(truncate(ema,2))
    txt5 = "RSI Value\n" + tostring(truncate(rsi,2))
    txt6 = "Percent Change\n" + tostring(truncate(mktChange,2)) + "%"
    table.cell(myTable, 0, 0, text=txt1, bgcolor=color.black, text_color=color.white)
    table.cell(myTable, 0, 1, text=txt2, bgcolor=color.black, text_color=color.white)
    table.cell(myTable, 1, 0, text=txt3, bgcolor=color.black, text_color=color.white)
    table.cell(myTable, 1, 1, text=txt4, bgcolor=color.black, text_color=color.white)
    table.cell(myTable, 2, 0, text=txt5, bgcolor=color.black, text_color=color.white)
    table.cell(myTable, 2, 1, text=txt6, bgcolor=(mktChange > 0 ? color.green : color.red), text_color=color.white)

Overview

Tables calculates the closing price, opening price, bar gain or loss, 50-period EMA, 14-period RSI, and percentage bar change. The table updates only on the last historical or live bar and formats numerical values using a custom decimal truncation function.

Details

Published by

Web3Degenerate on GitHub

Code credit

ZenAndTheArtOfTrading / www.PineScriptMastery.com, as written in the script's header

Type

Indicator, Pine Script v4

Draws

On the price chart

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.

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

Symbol Info Helper

by everget
947 stars

Symbol Info Helper is an informational utility script that displays metadata about the currently selected instrument directly on the main price chart. It gathers built-in symbol properties including ticker identifier, description, instrument type, point value,

Indicator v4 Screeners & dashboards
Updated 12 days ago · GPL-3.0 GitHub repository of Symbol Info Helper
575 stars

The indicator plots ICT displacement candles on the price chart and can switch to retracement scanning. Displacement requires a move larger than a set share of the 14-bar average high-low range, lasting at least a chosen number of bars, with optional close, pr

Indicator v6 SMC / ICT / price actionCandlestick patterns
Updated 1 year ago · MPL-2.0 GitHub repository of ICT Displacement Candles Indicator
330 stars

This indicator monitors multiple cryptocurrency symbols for trading signals. It calculates and plots entry prices, take profit, and stop loss levels for each symbol including BTCUSDT, ETHUSDT, BNBUSDT and others. Price crossovers trigger buy, sell or close ale

Indicator v5 Support & resistanceScreeners & dashboards
Updated 2 months ago · None stated GitHub repository of Multi Alert Long/Short [Alorse]

Pricing Table

by namuan
318 stars

This indicator calculates theoretical options contract values and in-the-money probabilities using historical realized volatility across multiple standard deviations. It displays these metrics in a table overlay directly on the price chart. Users can adjust th

Indicator v4 Volatility & bandsScreeners & dashboards
Updated 2 months ago · MIT GitHub repository of Pricing Table

3938 Tracker

by Allen1212
303 stars

3938 Tracker visualizes historical buying and selling activity from ARK Invest funds directly on the main price chart. It plots labels at specific timestamps corresponding to trade dates, indicating buy or sell actions along with the count of participating ETF

Indicator v4 Screeners & dashboards
Updated 2 years ago · None stated GitHub repository of 3938 Tracker

More Screeners & dashboards scripts

Related on ForexR

Trade Your Charts With a Regulated Broker

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

Compare brokers