CAPM Model with Returns TableThe given Pine Script is designed to implement the Capital Asset Pricing Model (CAPM) to calculate the expected return for a specified asset over various user-defined periods and compare it with the asset's historical mean return. The core features and functionalities of the script include:
Inputs:
Benchmark Symbol: Defaulted to "CRYPTOCAP:TOTAL". This serves as a comparison metric.
Risk-free Rate: Represents the return on an investment that is considered risk-free.
Benchmark Period: Used for plotting purposes. It doesn't affect table calculations.
Period Settings: Allows users to specify four different time periods for calculations.
Functionalities:
Computes daily returns for the benchmark and asset.
Calculates beta, which represents the volatility of the asset as compared to the volatility of the benchmark.
Uses CAPM to estimate expected returns over user-defined periods.
Generates a table displaying the expected return and asset's mean return for each period.
Provides implications based on the comparison between the expected returns and the asset's historical returns. This is showcased through a mutable label that is updated with each bar.
Visualization:
Plots expected return and asset's mean return over the benchmark period.
Provides a horizontal line to represent zero return.
Use Case:
This script can be helpful for traders or analysts looking to gauge the potential return of an asset compared to its historical performance using the CAPM. The implications provided by the script can serve as useful insights for making investment decisions. It's especially beneficial for those trading or analyzing assets in the cryptocurrency market, given the default benchmark setting.
Note: Before relying on this script for trading decisions, ensure a thorough understanding of its methodology and validate its assumptions against your research.
Value
BETA Benchmark - Tables!The indicator measures and plots the average beta of the defined periods of the selected asset, benchmarked with TOTAL.
Stablecoin Supply Ratio Oscillator
The Stablecoin Supply Ratio Oscillator (SSRO) is a cryptocurrency indicator designed for mean reversion analysis and sentiment assessment. It calculates the ratio of CRYPTO:BTCUSD 's market capitalization to the sum of stablecoins' market capitalization and z-scores the result, offering insights into market sentiment and potential turning points.
Methodology:
The SSRO is calculated as follows-
method ssro(float src, array stblsrc, int len) =>
float ssr = src / stblsrc.sum() // Source of the underlying divided by the sum of stablecoin sources
(ssr - ta.sma(ssr, len)) / ta.stdev(ssr, len) // Z-Score Transformed
This ratio is Z-Scored to provide a standardized measure, allowing users to identify periods of market fear or greed based on the allocation of capital between the underlying and Stablecoins ( CRYPTOCAP:USDT , CRYPTOCAP:USDC , CRYPTO:TUSD , CRYPTOCAP:BUSD , CRYPTOCAP:DAI , CRYPTOCAP:USDD , CRYPTOCAP:FRAX ). The z-scored values indicate potential areas of discount (buying opportunities) or premium (selling opportunities) relative to historical patterns.
Customization:
Underlying Asset: SSRO is customizable to different underlying assets, offering a versatile tool for various cryptocurrencies.
Calculation Length: Users can adjust the length of the calculation, tailoring the indicator to short or long-term analysis.
Visualization: SSRO can be displayed as candles, providing a visual representation of premium and discount areas.
Interpretation:
Market Sentiment: Lower SSRO values may indicate market fear, suggesting a preference for stablecoins as a relatively safer haven for capital. Conversely, higher values may suggest market greed, as more capital is allocated to the underlying asset.
Utility and Use Cases:
1. Mean Reversion Analysis: SSRO identifies potential mean reversion opportunities, guiding traders on optimal entry and exit points.
2. Sentiment Analysis: The indicator provides insights into market sentiment, aiding traders in understanding market dynamics.
3. Macro Analysis: The majority of cryptos follow \ correlate to CRYPTO:BTCUSD , Therefore by assessing premium and discount areas of CRYPTO:BTCUSD relative to the chosen underlying asset, users gain insights into potential market tops and bottoms.
4. Divergence Analysis: SSRO divergence from price trends can signal potential reversals, providing traders with additional confirmation for their decisions.
The Stablecoin Supply Ratio Oscillator is a valuable tool for cryptocurrency traders, offering a nuanced perspective on market sentiment and mean reversion opportunities. Its customization options and visual representation make it a versatile and powerful addition to the crypto analyst's toolkit.
Fair Value by MMEnglish
IMPORTANT NOTICE
This indicator is used to find fair value based on historical data. Past growth data may not be sustainable, which will cause the price targets given by the indicator to be inaccurate. Any price on this indicator cannot be considered as investment advice. Trading decisions are the responsibility of the person using the indicator.
What is the Fair Value by MM indicator?
This is an indicator that tries to find the fair value of a stock by looking at its historical data and growth over a certain period of time. By analyzing a stock's historical growth data, it generates a fair value and potential price estimate.
The indicator presents the financial data of a stock with 3 different data sets.
1. Summary and Valuation
2. Average Quarterly Growth
3. Profit margins
** Number of Lookback Periods for Quarters **
The first input of the indicator is where you specify how many quarters back to value the stock. By default, it is based on the last 12 quarters, i.e. 3 years. Since there is not enough historical data for newly listed companies, you can change this figure according to the company you are analyzing.
** Show Summary **
The Indicator starts in this mode by default. This mode gives you data such as sales, EBITDA, EBIT, net profit and free cash flow in PER SHARE and TTM values. The reason for using per share values is that a company's price is per share, and it saves you time to look at all other metrics on a per share basis. For example, if a company with a share price of $10 has sales per share of $5, we can say that this company has generated half of its market capitalization in sales revenue in the last 1 year.
In the indicator's default mode (Show Summary);
1. Sales per share TTM (Red)
2. EBITDA per share TTM (Orange)
3. EBIT per share TTM (Yellow)
4. Net Income per share TTM (Blue)
5. Free Cash Flow per share TTM (Green)
6. Share close price (White)
7. Fair value of the share (Green if price is below fair value, Red if price is above fair value)
8. Price target for the next 12 months (Yellow)
** Show AVG Growth QoQ **
When this option is selected, you can see the average quarterly growth in sales, EBITDA, EBIT, net profit and free cash flow, respectively, over the period you have selected (e.g. the last 12 quarters). This data gives an idea about the company's growth and the pace of its growth.
** Show Profit Margins **
When this option is selected, you can see gross profit margin, EBITDA margin, EBIT margin, net profit margin and free cash flow margin data respectively. It provides a quick overview to determine whether the company is increasing revenue by narrowing profit margins or increasing both revenue growth and profit margins.
** Include Sales **
When this option is selected, sales revenues are included in the company's valuation.
** Include Ebitda **
When this option is selected, EBITDA is included in the valuation of the company.
** Include Ebit **
When this option is selected, EBIT is included in the valuation of the company.
** Include Net Profit **
When this option is selected, net profit is included in the valuation of the company.
** Include FCF **
When this option is selected, free cash flow is included in the valuation of the company.
By default, the valuation is based on sales, EBITDA and EBIT. Net profit and free cash flow can be optionally selected. Or the metrics you do not want can be excluded from the valuation calculation.
What do the colors mean?
** Red **
Represents the company's data related to the company's sales.
** Orange **
Represents the company's data related to the company's EBITDA.
** Yellow **
Represents the company's data related to the company's EBIT.
** Blue **
Represents the company's data related to the company's Net Income.
** Green **
Represents the company's data related to the company's Free Cash Flow.
Turkish
ÖNEMLİ UYARI
Bu indikatör geçmiş verileri baz alarak adil değer bulmaya yarar. Geçmişte oluşan büyüme verileri sürdürelebilir olmayabilir, bu da indikatörün verdiği fiyat hedeflerinin yanılmasına sebep olacaktır. Bu indikatör üzerinde yer alan herhangi bir fiyat, yatırım tavsiyesi kapsamında değerlendirilemez. Alım/satım kararları indikatörü kullanan kişinin sorumluluğundadır.
Fair Value by MM indikatörü nedir?
Bu bir hissenin belirli bir periyotu kapsayan geçmiş verilerine ve gelişimlerine bakarak adil değerini bulmaya çalışan bir indikatördür. Bir hissenin geçmiş büyüme verilerini analiz ederek adil değer ve potansiyel fiyat tahmini oluşturur.
İndikatör bir hissenin finansal datasını 3 farklı veri seti ile sunmaktadır.
1. Özet ve Değerleme
2. Ortalama Çeyreklik Büyümeler
3. Kar marjları
** Number of Lookback Periods for Quarters **
İndikatörün ilk input’u, hisseyi değerlemek için kaç çeyrek geriye bakacağınızı belirttiğiniz kısımdır. Varsayılan olarak son 12 çeyrek, yani 3 yılı baz alır. Yeni arz olmuş şirketlerde yeterli geçmiş veri bulunmadığı için bu rakamı incelediğiniz şirkete göre değiştirebilirsiniz.
** Show Summary **
İndikatör varsayılan olarak bu modda başlar. Bu mod, satışlar, favök, esas faaliyet karı, net kar ve serbest nakit akışı gibi verileri HİSSE BAŞINA ve YILLIKLANDIRILMIŞ değerleri ile size verir. Hisse başına değerlerin kullanılmasındaki sebep, bir şirketin fiyatı hisse başınadır, ve diğer tüm metriklere hisse başına bakmak size zaman kazandırır. Örneğin, hisse fiyatı $10 olan bir şirketin, hisse başına satışları $5 ise, bu şirket son 1 yılda piyasa değerinin yarısı kadar satış geliri elde etmiş diyebiliriz.
İndikatörün varsayılan modunda (Show Summary);
1. Hisse başına yıllıklandırılmış Satışlar (Kırmızı)
2. Hisse başına yıllıklandırılmış FAVÖK (Turuncu)
3. Hisse başına yıllıklandırılmış Esas Faaliyet Karı (Sarı)
4. Hisse başına yıllıklandırılmış Net Kar (Mavi)
5. Hisse başına yıllıklandırılmış Serbest Nakit Akışı (Yeşil)
6. Hisse kapanış fiyatı (Beyaz)
7. Hissenin adil değeri (Fiyat Adil değerin altında ise Yeşil, Üstünde ise Kırmızı)
8. Önümüzdeki 12 aylık fiyat hedefi (Sarı)
** Show AVG Growth QoQ **
Bu seçenek seçildiğinde, sırası ile satışlar, favök, esas faaliyet karı, net kar ve serbest nakit akışının, seçmiş olduğunuz periyotta (örneğin son 12 çeyrek), çeyreklik olarak ortalama % kaç büyüdüğünü görebilirsiniz. Bu veri, şirketin gelişimi ve gelişim hızı hakkında fikir vermektedir.
** Show Profit Margings **
Bu seçenek seçildiğinde, sırası ile brüt kar marjı, favök marjı, esas faaliyet kar marjı, net kar marjı ve serbest nakit akışı marjı verilerini görebilirsiniz. Şirketin karlılık marjlarını daraltarak mı gelirini arttırdığını yoksa hem gelir artışı hem de kar marjlarını arttırdığını tespit etmek için hızlı bir bakış sunar.
** Include Sales **
Bu seçenek seçildiğinde, şirketin değerlemesine satış gelirleri dahil edilir.
** Include Ebitda **
Bu seçenek seçildiğinde, şirketin değerlemesine favök dahil edilir.
** Include Ebit **
Bu seçenek seçildiğinde, şirketin değerlemesine esas faaliyet karları dahil edilir.
** Include Net Profit **
Bu seçenek seçildiğinde, şirketin değerlemesine net kar dahil edilir.
** Include FCF **
Bu seçenek seçildiğinde, şirketin değerlemesine serbest nakit akışı dahil edilir.
Varsayılan olarak, satışlar, favök ve esas faaliyet karı üzerinden değerleme yapılır. Net kar ve serbest nakit akışı isteğe göre seçilebilir. Ya da istemediğiniz metrikler değerleme hesaplamasından çıkarılabilir.
Renkler ne anlama geliyor?
** Kırmızı **
Şirketin satışları ile ilgili verilerini temsil eder.
** Turuncu **
Şirketin favök’ü ile ilgili verilerini temsil eder.
** Sarı **
Şirketin esas faaliyet karı ile ilgili verilerini temsil eder.
** Mavi **
Şirketin net karı ile ilgili verileri temsil eder.
** Yeşil **
Şirketin serbest nakit akışı ile ilgili verilerini temsil eder.
FVG w/ Fibs [QuantVue]The "FVG w/ Fibs" indicator is a trading tool designed to identify and visualize Fair Value Gaps (FVGs) while overlaying two Fibonacci retracement levels.
• Bullish FVG: Occurs when the low of the current bar is higher than the high of two bars ago, and the previous close is higher than the high of two bars ago.
• Bearish FVG: Occurs when the high of the current bar is lower than the low of two bars ago, and the previous close is lower than the low of two bars ago.
The indicator filters these gaps based on user-defined criteria such as the minimum percentage size of the gap.
Once identified, these FVGs are highlighted on the chart using customizable boxes and the 50% and 61.8% (default settings) Fibonacci retracement levels are calculated and drawn based on the size of the identified FVG.
• Dynamically updates and extends the boxes as the price evolves.
• Alerts / visual changes for FVGs that get filled.
• User option for fills by Wicks or Close
• User-customizable settings for box colors, styles, and Fibonacci level appearances
Give this indicator a BOOST and COMMENT your thoughts!
We hope you enjoy.
Cheers!
Inflation-adjusted performanceOVERVIEW
The Inflation-adjusted performance indicator plots an adjusted closing price for the asset
on the main chart by multiplying the asset price by an inflation factor which is derived from CPI-U. The indicator has a `lookback` length, which is used to lookup the CPI-U index value from `lookback` years ago.
The inflation adjusted price is then calculated as `inflationAdjustedPrice = CPIToday / CPIBackThen * currentPrice`
CONCEPTS
This can be a useful tool to assess how an asset has performed as a store of value and inflation hedge over a given period.
The following are the key concepts and user inputs for the oscillator:
Input: The user can specify the lookback period, in years, using the `lookback` attribute on the settings widget. Defult is 13.
CPI Data: The indicator uses CPI data from tradingview's BLS feed.
Inflation Factor: An inflation factor is calculated by dividing today's CPI by the CPI from the lookback period. This factor represents the increase in prices due to inflation over the lookback period.
Inflation-adjusted Price: The offer price of the asset from `lookback` years ago is adjusted for inflation using the calculated inflation factor. This adjusted price represents what the offer price would be today if it had kept up with inflation.
Earnings Yield SpreadThe Earnings Yield Spread might offer an investor some insight into areas of value.
Earnings yield is the ratio of Diluted earnings per share over the trailing twelve months (TTM) to the company’s share price. Earnings yield shows how much the company has earned per share as a percentage of its share price. It shows investors how much yield they are getting in earnings in return for owning the stock at its current share price. (Thank you, TradingView)
One might wonder how the earnings yield on their investment compares to the yield on a US 10 year treasury bond. The Earnings Yield Spread indicator will read above zero if the stock in question earnings yield is higher than US10Y and will read below zero if the stock in question earnings yield is lower than the US10Y.
Earnings yield is relative to the stock in question, so comparisons should be drawn to its own historical reading and not to other symbols.
P/E RatioPlots the P/E Ratio with highest, lowest and average, as well as two ranges, 25-20 & 20-0 considered as the regular P/E Range
Fundamental ScreenerThis indicator is designed to compare the year-over-year earnings and sales growth, as well as the P/E ratio of up to 10 stocks simultaneously .
This provides valuable insights into the fundamental performance of multiple stocks at the same time, allowing traders to quickly identify which stocks are outperforming or underperforming their peers.
The earnings and sales growth figures are calculated on a year-over-year basis , comparing the most recent quarter to the same quarter 1 year ago.
The P/E ratio is a valuation metric that measures a company's stock price relative to its trailing twelve months earnings per share.
By comparing these three key metrics across multiple stocks, traders can quickly identify which stock in a group has superior fundamentals.
Customization
Chose to compare 5 or 10 symbols
Table position, color, and size
Median Value TradedThe Median Value Traded script is an indicator that allows traders to visualize the median value traded for a particular asset. The median value traded is an important metric as it provides a clearer understanding of the trading activity for an asset, which can be used to inform trading strategies.
To use this script, simply add it to your chart and adjust the "Lookback Period" input as desired. The "Lookback Period" input determines the number of bars used in the median calculation, with a default value of 20.
The median value traded is calculated by taking the product of the volume and closing price for each bar in the lookback period, calculates the median value, and then divides by one million for easier readability.
The script also includes color inputs for the positive and negative columns, allowing traders to customize the appearance of the plot to their liking.
Overall, the Median Value Traded script is a useful tool for traders looking to gain a deeper understanding of trading activity for a particular asset.
Dividend Percentile RankWhat it does
The Indicator plots the percentile rank of the current dividend yield within the configured lookback timeframe. A percentile rank of 80 means that in 80% of the time within the lookback period the dividend yield was below the current yield. And in the remaining 20% of the time it was above the current yield. While a percentile rank of 0 means that the current dividend yield is below all historical dividend yields within the lookback timeframe.
You can configure three values:
1. Lookback Trading Days: This is the timeframe of past trading days that are used to calculate the percentile rank. The default value is 765 days (~3years) while one trading year is about 252 days.
2. Buy threshold in %: Configures the green zone of the Dividend Percentile Chart
3. Buy threshold in %: Configures the red zone of the Dividend Percentile Chart
How it works
First, the Dividend Yield is calculated. After that, the dividend Yield is used to calculate the percentage rank within the configured lookback period. The result is plotted depending on the configured threshold zones.
What you can use it for
The Dividend Percentile Rank is plotted as an oscillator that oscillates between 0 and 100.
High values, e.g. above 80, can be considered as a buy signal as the current dividend yield is high in comparison to past dividend yields.
Low values, e.g. below 20, can be considered as a sell signal as the current dividend yield is lower in comparison to past dividend yields.
(PS: Always take into consideration to evaluate the companies ability to continue paying dividends in the future. The yield alone is no guarantee for high returns)
Grenblatt Magic FormulaThe magic formula is an investing strategy created by Joel Greenblatt that focuses on finding the best price to buy certain companies in order to maximize returns. When Greenblatt coined the term magic formula investing, his portfolio had a return of 24% from 1998 to 2009.
This means that $10,000 invested at 24% for the period would have turned into just over $1 million. A fund based on the S&P 500 index for the same period would have turned that $10,000 into just under $75,000.1
Note
Bigger returns matter, especially over long periods, due to the power of compounding.
Others who ran their own experiments were not able to duplicate Greenblatt's high returns but still yielded positive results. As a result, investing experts agree that the strategy of magic formula investing outperforms the indexes. In most cases, though, it doesn't seem to beat indexes by as much as Greenblatt indicated when he introduced the concept in his book, The Little Book That Beats the Market.
There are two ratios in the magic formula. The first is the earnings yield: EBIT /EV. This is earnings before interest and taxes divided by enterprise value.A simpler and more common version of this ratio is earnings /price. Greenblatt prefers EBIT over earnings , because EBIT more accurately compares companies with different tax rates. EV is preferred to share price because EV also factors in the company's debt. Therefore, EBIT /EV provides a better picture of overall earnings than earnings /price.
The second ratio is return on capital, which is EBIT /(Net Fixed Assets + Working Capital)
The first ratio looks at earnings before interest and taxes compared to enterprise value. The second ratio focuses on the earnings relative to tangible assets. Many assets listed on the balance sheet depreciate over time as their usefulness is used up. These types of assets are called "fixed assets."
Net fixed assets are fixed assets minus all the accumulated depreciation and any liabilities associated with the asset. This gives a more accurate sense of the real value of a company's assets, compared to just looking at the total asset number on the balance sheet . Working capital is also part of this ratio and is current assets minus current liabilities. This gives a picture of whether the company is likely able to continue operations in the short term.
While the two ratios in the magic formula look small, they actually are computing a lot of data about the inner workings of a company, including:
Earnings
Interest
Tax rates
Equity price
Debt
Depreciation of assets
Current assets
Current liabilities
Overvalued/Undervalued OverlayThis indicator will tell you whether the security you are looking at is overvalued or undervalued using a company's total assets and their market cap. In theory, a company's total assets is everything that they own, which then should technically be how much the company is worth. Therefore, if the company's market cap is higher than their total assets, the indicator will read "Overvalued by X%". However, if the company's market cap is lower than their total assets, the indicator will read "Undervalued by X%". If you have any questions, feel free to let me know. Keep in mind that this indicator should be only used for long-term investing.
Valuation RainbowValuation Rainbow
© danny_peanuts
Stock value based on Book Value, Earnings, Dividends and Money Multiplier
SV = (BVPS + EPS + DPS) * MM
BVPS = Book Value Per Share
EPS = Earnings Per Share
DPS = Dividends Per Share
MM = Money Multiplier - Integer Number from 1,2,3, ... ,7
There are multiple ways of valuing the stock. Book value is traditionally used as the basic valuation since it's calculate the total asset value minus the liabilities of any company. There are valuation based on multiplication of book value, there are valuation based on multiplication of earnings, and valuation based on multiplication of dividends. Here I'm proposing valuation based on all of these combined. So this indicator is measuring stock value based on multiplication of book value plus earning plus dividend per share. Since the money supply could have an multiplication effect so does the stock value could have a multiplication effect. Also notes that some blue chips stock tends to value higher than startup stock due to money is not equally distributed. So for simplicity I will use simple integer number to represent this multiplication effect as rainbow color plots, thus it can be applied to any stock at any given countries. The higher the stock price on valuation bands the most expensive it is and the lower the price on valuation bands the cheaper it is.
DCF ApproximationThe indicator for calculating and visualizing the Discounted Cash Flow (DCF) for a selected stock.
It uses the Weighted Average Cost of Capital (WACC) with a margin of safety and the Free Cash Flow (FCF) calculation for cash flow analysis. The DCF is calculated by summing the discounted annual FCFs over a 10-year period.
The chart color depends on the value of the current price percentage - it turns red when the market price is over valuation, yellow around a fair value, and green for the price under valuation.
This is an early version of the indicator, so I would appreciate your suggestions for improving the code and formulas.
FOREX MASTER PATTERN Value Lines by nnamThe Forex Master Pattern is form of technical analysis that provides a framework for spotting hidden price patterns that reveal the true movement of the market. The Forex Master Pattern Value Lines Indicator helps to identify this Phase 1 contraction of the Forex Master Pattern cycle.
HOW THIS INDICATOR WORKS
This indicator looks for a sustained contraction in price initially indicated by TWO contraction bars in a row, thus detecting a contraction point and a potential new master pattern origin point.
Once a contraction point is detected, a blue box will appear on the chart with a thick solid blue line projecting from its center. These are potential "Points of Origin" and "Value Lines" that institutional traders use to balance their books.
As shown above, when price begins to move (detected by engulfing and/or expansion candles), an Arrow is plotted to the chart identifying a possible expansion.
As shown above, previous Value Lines typically serve as future support / resistance points, however, due to the unique location of these lines, they are not typically identified as support or resistance levels on standard S/R indicators.
Color Coded Candles assist the user in quickly identifying contraction and expansion areas as well as trends away from the value-line. The expansion candles, Up/Down candles, and contraction BARS are all inspired by the STRAT (Rob Smith) and are specifically incorporated into this indicator to assist the user in finding potential reversals during the expansion phase. This helps to avoid the whiplash typically associated with the first phase of Forex Master Pattern.
USER DEFINED SETTINGS
- Line Settings Section -
#Max Lines to Show
This limits or extends the total number of lines shown on the chart. The Default is 12 (minimum is 1, maximum is 499).
#Show Lines on Chart
This setting turns all lines ON or OFF on the chart
#Show Value-Lines on Chart
This setting turns the Value Lines ON or OFF on the chart
#Set Value-Line Width
This setting sets the width of the value-line displayed on the chart
#Only show last value-line on the chart
This setting removes all but the most recent value-line from the chart
- Box Settings Section -
#Show Last Box Only
This setting turns OFF all previous boxes and only shows the most recent contraction box on the chart
- Expansion Area Settings Section -
#Show Expansion Area
This setting turns ON or OFF the expansion area fill
#Show Expansion Guidelines on Chart
This setting turns ON or OFF the guidelines that show the current direction of the price via an extended line.
- Candle Colors Section -
#Color Code the Candles
This setting turns on Color Coding for the Candles which changes the colors of each candle type:
1. Contraction Candle
2. Expansion Candle
3. Up Candle
4. Down Candle
5. Engulfing Candles (engulfing candles override other candle settings if turned ON)
- Engulfing Patterns Section -
#Show Engulfing Patterns
This setting turns ON or OFF engulfing candle plots globally
#Show Bullish Engulfing Candles
This setting allows the user to turn Bullish Engulfing signals ON or OFF
#Show Bearish Engulfing Candles
This setting allows the user to turn Bearish Engulfing signals ON or OFF
I hope you enjoy this indicator and that it provides some value. Please reach out to me with any suggestions or need training on the indicator.
Outliers Detector with N-Sigma Confidence Intervals (TG fork)Display outliers in either value change, volume or volume change that significantly deviate from the past.
This uses the standard deviation calculation and the n-sigmas statistical rule of significance, with 2-sigma (a value of 2) signifying that the observed value is stronger than 95% of past values, and 3-sigma 98.5% of past values, and so on for higher sigma values.
Outliers in price action or in volume can indicate a strong support for the move, and hence potentially more moves in the same direction in the future. Inversely, an insignificant move is less likely to be supported. And of course the stronger, the more support.
This indicator also doubles as a standard volume indicator if volume is selected as the source, but with the option of highlighting outliers.
Bars below significance can be uncolored (gray) to unclutter the visuals.
Differently to almost all other similar indicators, the background highlighting is dynamical, so that all values will be highlighted differently, not just 2-sigma or 3-sigma, but also 4-sigma, 5-sigma, etc, with a different value of transparency.
The dynamical transparency value can be calculated in two ways: either statically proportionally to the n-sigma but capped at 10-sigma, or either as a ratio relative to the highest observed sigma value over the defined lookback period (default: 300).
If you like this indicator, which is an extension of previously published indicators, please give some love to the original authors:
* tvjvzl :
* vnhilton :
This extension, authored by Tartigradia, extends tvjvzl's indi, implements vnhilton's idea of highlighting the background, and go further by adding dynamical background highlighting for any value of sigma, add support for volume and volume change (VolumeDiff) as inputs, add option to uncolor insignificant bars, allow plotting in both directions and more.
Rule Of 20 - Fair Value Estimation by Inflation & Earnings (TG)The Rule Of 20 is a heuristic calculation to find the fair value of an asset or market given its earnings and current inflation.
Its calculation is straightforward: the fair multiple of the price or price-to-earnings ratio of a stock should be 20 minus the rate of inflation.
In math terms: fair_price-to-earnings_ratio = (20 - inflation) ; fair_value = current_price * fair_price-to-earnings_ratio / real_price-to-earnings_ratio
For example, if a stock or index was trading on 11 times earnings and inflation was 2%, then the theory would be that the fair price-to-earnings ratio would be 20-2 = 18, which is much higher than the real price-to-earnings ratio of 11, and hence the asset would be undervalued.
Conversely, a market or company that was trading on 18 times price-to-earnings ration when inflation was 8% was seen as overvalued, because of the fair price-to-earnings ratio being 20-8=12, hence much lower than the real price-to-earnings ratio of 18.
We can then project the delta between the fair PE and real PE onto the asset's value to obtain the projected fair value, which may be a target of future value the asset may reach or hover around.
For example, as of 1st November 2022, SPX stood at 3871.97, with a PE ratio of 20.14 and an inflation in the US of 7.70. Using the Rule Of 20, we find that the fair PE ratio is 20-7.7=12.3, which is much lower than the current PE ratio of 20.14 by 39%! This may indicate a future possibility of a further downside risk by 39% from current valuation levels.
The origins of this rule are unknown, although the legendary US fund manager Peter Lynch is said to have been an active proponent when he was directing the Fidelity’s Magellan fund from 1977 to 1990.
For more infos about the Rule Of 20, reading this article is recommended: www.sharesmagazine.co.uk
This indicator implements the Rule Of 20 on any asset where the Financials are availble to TradingView, and also for the entire SP:SPX index as a way to assess the wider US stock market. Technically, the calculation is a bit different for the latter, as we cannot access earnings of SPX through Financials on TradingView, so we access it using the QUANDL:MULTPL/SP500_PE_RATIO_MONTH ticker instead.
By default are displayed:
current asset value in red
fair asset value according to the Rule Of 20 in white for SPX, or different shades of purple/maroon for other assets. Note that for SPX there is only one calculation, whereas for other assets there are multiple different ways to calculate earnings, so different fair values can be computed.
fair price-to-earnings ratio (PE ratio) in light grey.
real price-to-earnings ratio in darker grey.
This indicator can be used on SP:SPX ticker, and on most NASDAQ:* tickers, since they have Financials integrated in TradingView. Stocks tickers from other exchanges may not provide Financials data, so this indicator won't work then. If this happens, try to find the same ticker on NASDAQ instead.
Note that by default, only the US stock market is considered. If you want to consider stocks or assets in other regions of the world, please change the inflation ticker to a ticker that reflect the target region's inflation.
Also adding a table to ease interpretation was considered, but then the Timeframe MTF parameter would not work, and since the big advantage of this indicator is to allow for historical comparisons, the table was dropped.
Enjoy, and keep in mind that all models are wrong, but some are useful.
Trade safely!
TG
CROCEUsing free cash flow instead of ebit, to be able to evaluate stocks that are not yet profitable.
the formulas are
fcf ttm / (not financial operating working capital - Cash + Net Property Plant and Equipment)
and
fcf yield on Enterprice Value
Example CRWD negative ebit, but cash creation, in this case the expenses in research and development go to affect the ebit.
Capital Asset Pricing Model (CAPM) [Loxx]Capital Asset Pricing Model (CAPM) demonstrates how to calculate the Cost of Equity for an underlying asset using Pine Script. This script will only work on the monthly timeframe. While you can change the default inputs, you should study what CAPM is and how this works before doing so. This indicator pulls various types of data from SPY from various timeframes to calculate risk-free rates, market premiums, and log returns. Alpha and Beta are computed using the regression between underlying asset and SPY. This indicator only calculates on the most recent data. If you wish to change this, you'll have to save the script and make adjustments. A few examples where CAPM is used:
Used as the mu factor Geometric Brownian Motion models for options pricing and forecasting price ranges and decay
Calculating the Weighted Average Cost of Capital
Asset pricing
Efficient frontier
Risk and diversification
Security market line
Discounted Cashflow Analysis
Investment bankers use CAPM to value deals
Account firms use CAPM to verify asset prices and assumptions
Real estate firms use variations of CAPM to value properties
... and more
Details of the calculations used here
Rm is calculated using yearly simple returns data from SPY, typically this is just hard coded as 10%.
Rf is pulled from US 10 year bond yields
Beta and Alpha are pulled form monthly returns data of the asset and SPY
In the past, typically this data is purchased from investments banks whose research arms produce values for beta, alpha, risk free rate, and risk premiums. In 2022 ,you can find free estimates for each parameter but these values might not reflect the most current data or research.
History
The CAPM was introduced by Jack Treynor (1961, 1962), William F. Sharpe (1964), John Lintner (1965) and Jan Mossin (1966) independently, building on the earlier work of Harry Markowitz on diversification and modern portfolio theory. Sharpe, Markowitz and Merton Miller jointly received the 1990 Nobel Memorial Prize in Economics for this contribution to the field of financial economics. Fischer Black (1972) developed another version of CAPM, called Black CAPM or zero-beta CAPM, that does not assume the existence of a riskless asset. This version was more robust against empirical testing and was influential in the widespread adoption of the CAPM.
Usage
The CAPM is used to calculate the amount of return that investors need to realize to compensate for a particular level of risk. It subtracts the risk-free rate from the expected rate and weighs it with a factor – beta – to get the risk premium. It then adds the risk premium to the risk-free rate of return to get the rate of return an investor expects as compensation for the risk. The CAPM formula is expressed as follows:
r = Rf + beta (Rm – Rf) + Alpha
Therefore,
Alpha = R – Rf – beta (Rm-Rf)
Where:
R represents the portfolio return
Rf represents the risk-free rate of return
Beta represents the systematic risk of a portfolio
Rm represents the market return, per a benchmark
For example, assuming that the actual return of the fund is 30, the risk-free rate is 8%, beta is 1.1, and the benchmark index return is 20%, alpha is calculated as:
Alpha = (0.30-0.08) – 1.1 (0.20-0.08) = 0.088 or 8.8%
The result shows that the investment in this example outperformed the benchmark index by 8.8%.
The alpha of a portfolio is the excess return it produces compared to a benchmark index. Investors in mutual funds or ETFs often look for a fund with a high alpha in hopes of getting a superior return on investment (ROI).
The alpha ratio is often used along with the beta coefficient, which is a measure of the volatility of an investment. The two ratios are both used in the Capital Assets Pricing Model (CAPM) to analyze a portfolio of investments and assess its theoretical performance.
To see CAPM in action in terms of calculate WACC, see here for an example: finbox.com
Further reading
en.wikipedia.org
CPI and PPIMarket tracker of the year-on-year (YoY) change in inflation (both PPI Finished Goods and CPI).
Useful for identifying the turns in market conditions, and therefore helps with anticipation of changes in monitory policy.
This metric can be used to inform about current market conditions and potential risk=reward outcomes in the future.
MQ ValueCharts(R)What does ValueCharts(R) do?
There are three primary attributes that help determine price, and that's Cost, Momentum and Value. ValueCharts(R) provides the value component in helping to understand whether price is overpriced or underpriced, which can help determine the optimal time to get into or out of a market. ValueCharts(R) is designed to identify when a stock, option, futures, forex, crypto, index, etc. is overvalued, fairly valued, or undervalued. If a market is overvalued, then it's less likely to keep rising in price. If a market is undervalued, then it's less likely for its price to continue falling.
How does ValueCharts(R) work?
ValueCharts(R) calculates value based on price variability. It analyzes price ranges and movement over a user-specified number of bars to identify when price is at a value extreme relative to a longer-term view of price variability. ValueCharts(R) is an original indicator based on the patented ValueCharts concept (U.S. Patent No. 7,461,023), which is held by the script author. The validity of the ValueCharts algorithm has been vetted by leading experts at Wharton School of Business, the University of Michigan, and UCLA.
Since value is often related to recent price action, two equal adjacent bars with identical open, high, low, and close may have different value scores, since an equal prior bar can affect the value of the current bar. Thus, value can vary even when price does not move. Value varies by timeframe as well, allowing users to identify value correlation between timeframes within the same market. Users can identify being significantly overvalued on a daily chart and adjust their intraday trading with the daily value in mind. Users can adjust the number of bars considered in the calculations to provide a shorter-time view with higher responsiveness, or a longer-term view that reflects a more gradual value scoring. Smaller AnalysisPeriod input values, such as 5, result in greater responsiveness of the indicator to reflect more immediate value extremes. Larger values, such as 14, are more applicable to longer multi-day trades and longer value trends, while shorter inputs are more useful for day trading, for example. A second input, ScalingMultiplier, is a multiplying factor that is generally left unchanged at 0.2, but can be used to linearly expand or contract the subgraph plot values.
We generally find lower AnalysisPeriod values to work best as they provide the greatest responsiveness, even across higher timeframes. ValueCharts(R) determines a mathematical score for each bar's open, high, low and close, and plots the results on a subgraph as an OHLC bar atop color ranges drawn as regions on the subpanel. The color ranges depict 5 different states: Significantly Overvalued (Upper Red), Moderately Overvalued (Upper Yellow), Fairly Valued (Middle Green), Moderately Undervalued (Lower Yellow), and Significantly Undervalued (Lower Red). This makes it simple for users to identify when value is in any of these 5 states so they can make informed decisions about where price may go next, helping to determine when to get in or out of trades.
How is ValueCharts(R) best used?
ValueCharts(R) scores its results and maps them onto a color-coded subgraph to inform the user of the current Value status. Users typically monitor the high point and low points of the bar plot within the indicator to identify what color band each bar reaches. If a bar reaches into a color band, then we consider that bar to be in that state. For example, if a ValueCharts bar reaches into the upper red zone, then it's considered "Significantly Overvalued", and the corresponding price bar is considered "significantly overvalued". Our analysis has shown that when a price bar is significantly overvalued, there's a greater than 90% chance that price will not continue much further, and could possibly reverse at that point. Similarly, when a bar is considered Significantly Undervalued, there's a greater than 90% chance that price will stop falling, perhaps moving sideways, or even reverse higher. This doesn't happen all time, of course, and some markets respond more faithfully than others. Users can see the historical plots to determine whether the current market is aligning well with the signals in the currently selected timeframe. While no one can guarantee what the next bar will do, we can quickly see whether previous ValueCharts(R) signals have worked well for this symbol and timeframe.
Value Zones are as follows:
Significantly Overvalued (red)
Moderately Overvalued (yellow)
Fairly Valued (green)
Moderately Undervalued (yellow)
Significantly Undervalued (red)
The yellow zones depict moderately over- and undervalued zones, where there's a roughly 67% chance that a market will stop moving in that direction. In the center, the green "Fairly Valued" zone is when a market is neither over- nor undervalued. We can sometimes use this zone as a "Value Reset" area, where we move back to a neutral value position, and can move in either an over- or undervalued direction from there. We often see that momentum will continue to push value into the opposite extreme rather than reverse. This works well, as we can sometimes experience markets that are cycling from overvalued to undervalued and back again, which is especially applicable to non-trending markets.
Multi-timeframe Convergence
We can also use ValueCharts(R) across multiple timeframes for the same symbol to identify Multi-Timeframe Value Convergence. If we are significantly Overvalued on more than one timeframe, it creates a more compelling value case than one timeframe alone. In addition, Value state can be more significant on a higher timeframe. We use this concept in implementing a no-trade filter, for example, where if we're significantly undervalued on the 240-minute chart, we refrain from taking bearish trades for the remainder of that trading day, since there's a greater than 90% chance that price will not move lower once it's Value is significantly undervalued.
Inputs:
AnalysisPeriod Value from 5 to n, identifies how many bars of history to consider in value determination, defaults to 5 for fastest responsiveness, though some longer-term traders prefer 14.
Mult A scaling multiplier to amplify the results. Typically keep this at 0.2
SignificantColor Color of the Significantly Overvalued and Significantly Undervalued color ranges, defaults to Red
ModerateColor Color of the Moderately Overvalued and Moderately Undervalued color ranges, defaults to Yellow
FairColor Color of the Fairly Valued color range, defaults to Green
BarColor Color of the bar that overlays the Value color bands within the indicator plot. Defaults to Gray so it appears on both light and dark charts. Suggest using White or Black depending on dark or light colored charts.
Transparency The % transparency level of the indicator's color regions, making it easier to see the Value OHLC bar that appears in front of it. Defaults to 60 for 60%. 0 is opaque, 100 is fully transparent.
Version Provides the version number / ID of the indicator
Additional usage suggestions
Visibility: ValueCharts(R) works on either a light or dark color theme. By default, the indicator's OHLC bars are gray, which is visible on either color theme. You can increase the contrast by changing the Bar Color input to Black on a light background, or to White on a dark background. You can also enhance the visibility by setting the input, Color Transparency to a larger number, such as 60. This will mute the colors, allowing the OHLC bars to stand out more.
PEG Ratio (Most Accurate)Price Earnings To Growth (PEG) Ratio
PEG ratio is a stock's PE ratio divided by the growth rate of its earnings for a specified time period.
The PEG ratio is used to determine a stock's value while also factoring in the company's expected earnings growth, and it is thought to provide a more complete picture than the more standard P/E ratio.
PEG ratio 1 is fair value.
PEG ratio above > 2 is are generally considered overvalued.
PEG ratio below < 1 is Undervalued.
Negative PEG ratio indicate the company no growing in specified time period.
Example of How to Use the PEG Ratio
The PEG ratio provides useful information to compare competitive companies and see which stock might be the better choice for an investor's needs, as follows.
Google (13-Sep-2022) 👍
PEG ratio = 0.38%
P/E ratio = 19.17%
Meta (13-Sep-2022) 👎
PEG ratio = 0.63%
P/E ratio = 12.55%
Many investors may look at Meta and find it more attractive since it has a lower P/E ratio. But compared to Google, it doesn't have a high enough growth rate to justify its current P/E.
Google is trading at a discount to its growth rate and investors purchasing it are paying less per unit of earnings growth. Based on its lower PEG, Google may be relatively the better buy.