OPEN-SOURCE SCRIPT

Stock Data Table

Updated
█ OVERVIEW

This is a table that shows some information about stocks. It is divided into four sections:
 1) Correlation
 2) Shares
 3) Daily Data
 4) Extended Session Data

The table is completely modular, which means you can add or remove each element from the settings menu, and it will automatically rearrange its spaces.
It is also highly customizable, to the extent that you can change almost any color, remove or change titles, invert section rows, and much more.



1) Correlation

The script checks if the stock is listed on NASDAQ, and if so, uses the QQQ (Nasdaq-100 ETF) as the reference index in the first cell; otherwise, it uses the SPY (S&P 500 ETF). The length of the correlation is shown in the second cell. The table then displays the correlation between the reference index and the other index, and the correlation between the reference index and the stock.
To make it easier to interpret the correlation values, each row's last cell is color-coded with a gradient to highlight the type of correlation, and the direction of the gradient can be customized.

The correlation coefficient is a statistical measure that quantifies the strength and direction of the relationship between two variables, indicating how changes in one variable are associated with changes in the other variable, so it can be used to identify patterns and trends.
If you are interested in correlation, I suggest taking a look at my dedicated indicator:
Correlation with Matrix Table



2) Shares

This feature provides you with quick access to key information about shares and market capitalization.

On one row, you can view the total shares outstanding and the market capitalization for the fiscal year or the quarterly year. The total shares outstanding represents the total number of shares of the stock that have been issued and are currently outstanding, regardless of whether they are held by insiders or public investors. The market capitalization is a widely used measure of the company's value as determined by the stock market, calculated by multiplying its current stock price with the total number of outstanding shares.

The other row shows the float, which is the number of shares of a company that are available for public trading, and the corresponding free-float market cap, calculated by multiplying the company's current stock price with the float. Because Pine Script does not allow retrieving information about quarterly year float, you can view the float and the free-float market cap of the fiscal year only. The data can be displayed at all times or only when the difference between the total shares outstanding and the float is significant enough to result in a difference between the market cap and free-float market cap.

The classification for market cap and free-float market cap is set in this way:
  • Mega Cap: $200 billion or more
  • Large Cap: between $10 billion and $200 billion
  • Mid Cap: between $2 billion and $10 billion
  • Small Cap: between $300 million and $2 billion
  • Micro Cap: less than $300 million
  • Penny Stocks: less than $5 (customizable)


Comparing the free-float market cap to the market cap can provide insights into the liquidity of a stock. In fact, if the float is relatively small compared to the total shares outstanding, it may be more difficult to find buyers or sellers, which could lead to increased volatility. On the other hand, a larger float indicates that the stock is more liquid and may be easier to trade, potentially resulting in lower volatility. However, market conditions can change quickly and significantly, especially for intraday traders, and the free-float can also change as insiders or other large shareholders buy or sell shares. Therefore, comparing the data of the fiscal year with that of the quarterly year may not provide the most up-to-date and accurate information for making trading decisions. This limitation can be mitigated by combining those data with other indicators and tools, such as technical analysis or news events, to gain a better understand of the stock's performance and potential trading opportunities.


3) Daily Data

This section is available on daily charts only due to the lack of accuracy of real-time daily data on other time frames. Here, you can view the Average Daily Volume (ADV) over a preferred time range (20 days by default), and the Daily Change, which represents the percentage difference between the closing price on two consecutive trading days.

ADV is useful in measuring the stock's volatility, as it provides an indication of how much trading activity there is in it. Generally speaking, stocks with higher trading volume tend to be less volatile than stocks with lower trading volume. High trading volume means there are more buyers and sellers actively trading the stock, which makes it easier for investors to buy and sell shares at fair prices. This increased liquidity can help to stabilize the stock price, reducing the potential for large swings in either direction. On the other hand, stocks with lower trading volume may experience greater volatility, as there are fewer buyers and sellers actively trading the stock. This can result in larger price swings, as it may be more difficult for investors to buy or sell shares at fair prices.

The daily percentage change can provide an indication of the stock's volatility, with larger values indicating greater volatility and risk. It can also be compared to that of a benchmark such an index or other stocks in the same sector, helping to determine whether the stock is outperforming or underperforming relative to them.


4) Extended Session Data

The fourth section is available on intraday charts only. This section provides two pieces of information: the Extended Session Change and the Pre-Market Volume.

The Extended Session Change indicates the percentage difference between the previous day's closing price and the latest price in the extended session. This gives you the extent and the direction of the price gap that occurred during extended trading hours.

The Pre-Market Volume shows the sum of all shares traded during the pre-market session. This can be helpful in understanding how much interest the stock gained before the market opened.

By default, the two rows will be visible at all times. They will stop updating after the end of their respective time range, and resume updating when it starts again. However, you can choose to automatically hide them outside of their time ranges.
Both the extended session and pre-market time ranges can be customized. Please note that if you select time ranges outside of the regular market session (as set by default), you must enable the extended session to view the corresponding rows.




█ GENERAL NOTES

 • Total Shares Outstanding, Float, Average Daily Volume and Pre-Market Volume cells use a customizable color system based on two thresholds, to help you quickly identify whether the value is "too low/acceptable/too high" or "too low/not enough high/acceptable".

 • If you cannot see certain data, that simply means it is not available.
Release Notes
UPDATE:

Added a row with the Average True Range (ATR) (customizable period and timeframe).
The ATR is a technical indicator developed by J. Welles Wilder Jr. to provide traders with insight into the potential price movement and volatility of a security. It is calculated by taking the average of the true range values over a specified period. The true range is the greatest of the following three values: the difference between the current high and the current low, the difference between the current high and the previous close, and the difference between the current low and the previous close.
This indicator can be useful for many reasons, such as:
- Volatility measurement: It helps traders assess the degree of price fluctuations or volatility in an asset. Higher ATR values indicate greater volatility, while lower values suggest lower volatility.
- Risk management: Traders can use the ATR to set stop-loss levels or determine position sizing based on the expected price range.
- Entry and exit signals: The ATR can assist in identifying optimal entry and exit points for trades. For example, breakouts above or below the recent ATR levels may indicate potential trend continuation or reversals.
Release Notes
Major Fix:

Corrected a problem relative to the number of rows.
Release Notes
UPDATE:

Added the possibility to choose between the standard ATR and the normalized ATR. The normalized ATR calculates the movement of the ATR as a percentage instead of price, allowing you to compare the volatility of different stocks.
Release Notes
UPDATE:

You can now visualize both the ATR and the Normalized ATR simultaneously.
The ATR cell now utilizes the customizable two-thresholds color system.
Release Notes
UPDATE:

You can now choose a different color for the Normalized ATR cell when the value reaches a customizable threshold.
Release Notes
UPDATE:

The two-threshold-based colorization system can now be optionally deactivated for all items, and is also available for the normalized ATR.
Release Notes
UPDATE

- Added two optional lines displaying the company's sector and industry.

- Cleaned the code.
Release Notes
Minor Fix:

Now the "Shares" and "Float" titles are not displayed if the number of shares is not available for the selected instrument.
Release Notes
UPDATE

- Thanks to a Pine Script improvement, Total Shares Outstanding and Float are now both automatically displayed with the most up-to-date data.

- Now you can choose whether to display the correlation length or not.

- The Sector and Industry rows will not appear if the instrument is different from a stock or ETF.

- Cleaned the code and corrected a typo in the menu.
Release Notes
UPDATE

Average Daily Volume and Daily Change can now be displayed on intraday charts.
Release Notes
UPDATE

- Now you can choose to correlate the stock with a custom benchmark.

- Cleaned the code.
ATRaverage-volumechangecorrelationDaily Chartsextended-sessionmarket-cappre-marketsharesstatisticsVolatilityVolume

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?

Disclaimer