Indicator · Pine Script v4 · On the chart

Databox

by rosskevin· code credited to sheldonth

Databox is an overlay indicator that fetches and displays fundamental financial data directly on the main price chart.

View on GitHub

GitHub stars1on the repository
Pine versionv4older, still runs
Lines of code40
Settings0inputs
LicenceAGPL-3.0
Last update5 years ago12 Feb 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

40 lines of Pine Script v4 from revbox.pine, published under AGPL-3.0. Keep the author's credit and licence lines when you reuse it.

revbox.pine
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © sheldonth
// https://www.tradingview.com/pine-script-reference/v4/?solution=43000564727#fun_financial
//@version=4
truncate(number, decimals) =>
    factor = pow(10, decimals)
    int(number * factor) / factor
    
study("Databox", overlay=true)
shares = truncate(financial(syminfo.tickerid, "TOTAL_SHARES_OUTSTANDING", "FQ") / 1000000, 2)
book = truncate(financial(syminfo.tickerid, "BOOK_VALUE_PER_SHARE", "FQ"), 2)
cash = truncate(financial(syminfo.tickerid, "CASH_N_EQUIVALENTS", "FQ") / 1000000, 2)
buyback = truncate(financial(syminfo.tickerid, "BUYBACK_YIELD", "FQ"), 2)
buyback_amt = truncate(financial(syminfo.tickerid, "PURCHASE_OF_STOCK", "FQ") / 1000000, 2) * -1
earnings_est = truncate(financial(syminfo.tickerid, "EARNINGS_ESTIMATE", "FQ"), 2)
earnings_est_y = truncate(financial(syminfo.tickerid, "EARNINGS_ESTIMATE", "FY"), 2)
sales_est = truncate(financial(syminfo.tickerid, "SALES_ESTIMATES", "FQ") / 1000000, 2)
sales_est_y = truncate(financial(syminfo.tickerid, "SALES_ESTIMATES", "FY") / 1000000, 2)
textComplete = '~~~ Financials ~~~\n' +
  "Book:   " + '$' + tostring(book) + '\n' + 
  "Cash:   " + '$' + tostring(cash) + 'MM' + '\n' +
  "Shrs:     " + tostring(shares) + "MM" + "\n" +
  "Repr:   " + "$" + tostring(buyback_amt) + "MM" + '\n' +
  "Buyb:     "  + tostring(buyback) + '%' + "\n" +
  "EPSQ:    $" + tostring(earnings_est) + '\n' + 
  "EPSY:    $" + tostring(earnings_est_y) + '\n' + 
  "RevQ:    $" + tostring(sales_est) + 'MM' + '\n' +
  "RevY:    $" + tostring(sales_est_y) + 'MM'  
n = bar_index, o = open, c = close
label l = label.new(
  x=n,
  y=c,
  xloc=xloc.bar_index,
  yloc=yloc.belowbar,
  text=textComplete,
  color=color.black,
  style=label.style_label_left,
  textcolor=color.white,
  textalign=text.align_left)
label.delete(l[1])

Overview

Databox retrieves key corporate metrics such as book value per share, cash and equivalents, total shares outstanding, stock buyback yield, and quarterly or yearly estimates for earnings and sales. The script formats these fundamental metrics into a compact text label positioned below the latest bar. It provides equity traders with fundamental context alongside technical chart analysis.

Details

Published by

rosskevin on GitHub

Code credit

sheldonth, as written in the script's header

Type

Indicator, Pine Script v4

Draws

On the price chart

Category

Screeners & dashboards

Markets

Stocks

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
948 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 10 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 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