1Copy the scriptPress Copy script above, or the copy button on the code below.
2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.
Source Code
119 lines of Pine Script v5 from PineScript/data-panel.pine, published under MPL-2.0. Keep the author's credit and licence lines when you reuse it.
data-panel.pine
//@version=5
indicator("Data Panel", overlay=true)
// Input parameters
var float dcr_benchmark = input.float(50, "DCR Benchmark %", minval=0, maxval=100, step=1)
var float wcr_benchmark = input.float(50, "WCR Benchmark %", minval=0, maxval=100, step=1)
tablePosition = input.string("Top Right", "Table Position", options=["Top Right", "Top Left", "Bottom Right", "Bottom Left"], group="Appearance")
// Colors
var color GREEN_COLOR = #00897B
var color RED_COLOR = #FF5252
var color BLUE_COLOR = #2962FF
// Calculate Daily Closing Range
calcDCR() =>
float dcr = 0.0
dcr := high != low ? ((close - low) / (high - low)) * 100 : 0
dcr
// Calculate Weekly Closing Range
calcWCR() =>
var float wcr = 0.0
if timeframe.isweekly
wcr := high != low ? ((close - low) / (high - low)) * 100 : 0
wcr
// Get formatted value with color
getFormattedValue(value, isPercentage = false) =>
if na(value)
["-", color.gray]
else
valueStr = isPercentage ? str.tostring(value, "#.##") + "%" : str.tostring(value, "#.##")
valueColor = value > 0 ? GREEN_COLOR : value < 0 ? RED_COLOR : color.gray
[valueStr, valueColor]
// Format large numbers
formatNumber(num) =>
string result = ""
if na(num)
result := "-"
else if math.abs(num) >= 1000000000
result := str.tostring(num / 1000000000, "#.##") + "B"
else if math.abs(num) >= 1000000
result := str.tostring(num / 1000000, "#.##") + "M"
else
result := str.tostring(num, "#.##")
result
// Calculate percentage change
calcPercentChange(current, previous) =>
float change = 0.0
if not na(current) and not na(previous) and previous != 0
change := ((current - previous) / math.abs(previous)) * 100
change
// Table position
var tablePos = switch tablePosition
"Top Right" => position.top_right
"Top Left" => position.top_left
"Bottom Right" => position.bottom_right
"Bottom Left" => position.bottom_left
=> position.top_right
// Create and update table
var table dataPanel = table.new(tablePos, 7, 6, border_width=1)
// Get quarterly data
eps = request.financial(syminfo.tickerid, "EARNINGS_PER_SHARE_BASIC", "FQ", barmerge.gaps_off)
sales = request.financial(syminfo.tickerid, "TOTAL_REVENUE", "FQ", barmerge.gaps_off)
net_income = request.financial(syminfo.tickerid, "NET_INCOME", "FQ", barmerge.gaps_off)
total_equity = request.financial(syminfo.tickerid, "TOTAL_EQUITY", "FQ", barmerge.gaps_off)
// Update table on each bar
if barstate.islast
// Calculate indicators
dcr = calcDCR()
wcr = calcWCR()
// Clear table
table.clear(dataPanel, 0, 0, 6, 5)
// Headers
table.cell(dataPanel, 0, 0, "Reported", bgcolor=BLUE_COLOR, text_color=color.white)
table.cell(dataPanel, 1, 0, "EPS ($)", bgcolor=BLUE_COLOR, text_color=color.white)
table.cell(dataPanel, 2, 0, "% Chg", bgcolor=BLUE_COLOR, text_color=color.white)
table.cell(dataPanel, 3, 0, "Sales ($)", bgcolor=BLUE_COLOR, text_color=color.white)
table.cell(dataPanel, 4, 0, "% Chg", bgcolor=BLUE_COLOR, text_color=color.white)
table.cell(dataPanel, 5, 0, "ROE", bgcolor=BLUE_COLOR, text_color=color.white)
// Data rows
for i = 0 to 4
current_eps = eps[i]
prev_eps = eps[i + 1]
current_sales = sales[i]
prev_sales = sales[i + 1]
// Calculate ROE (Net Income / Total Equity)
current_roe = net_income[i] / total_equity[i] * 100
eps_change = calcPercentChange(current_eps, prev_eps)
sales_change = calcPercentChange(current_sales, prev_sales)
[eps_str, eps_color] = getFormattedValue(current_eps)
[eps_change_str, eps_change_color] = getFormattedValue(eps_change, true)
[sales_str, sales_color] = getFormattedValue(current_sales)
[sales_change_str, sales_change_color] = getFormattedValue(sales_change, true)
[roe_str, roe_color] = getFormattedValue(current_roe, true)
table.cell(dataPanel, 0, i + 1, "Q" + str.tostring(4 - i))
table.cell(dataPanel, 1, i + 1, eps_str, text_color=eps_color)
table.cell(dataPanel, 2, i + 1, eps_change_str, text_color=eps_change_color)
table.cell(dataPanel, 3, i + 1, formatNumber(current_sales), text_color=sales_color)
table.cell(dataPanel, 4, i + 1, sales_change_str, text_color=sales_change_color)
table.cell(dataPanel, 5, i + 1, roe_str, text_color=roe_color)
// Add disclaimer
var label disclaimer = label.new(bar_index, high, "TradingView data for EPS & Sales can be highly inaccurate in some cases.",
color=color.gray, style=label.style_label_down, textcolor=color.gray)
label.delete(disclaimer[1])
Overview
Data Panel requests financial metrics such as basic earnings per share, total revenue, net income, and total equity across recent quarters, displaying percentage changes and return on equity. It also evaluates daily and weekly closing ranges against customizable benchmark thresholds. Settings allow selecting table placement and modifying performance thresholds.
Displays quarterly EPS, revenue, and ROE metrics
Calculates percentage changes across consecutive quarters
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
DCR Benchmark %
float
50
dcr_benchmark
WCR Benchmark %
float
50
wcr_benchmark
Table Position
string
Top Right
tablePosition
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.
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,
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
This indicator classifies each bar as bull, bear, or sideways from a rolling log return compared with adjustable percentage thresholds. It paints a regime ribbon on the price chart, shows a current-regime banner, and labels state changes after a minimum hold.
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
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
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