S&P 500 Earnings Yield SpreadThis indicator compares the attractiveness of equities relative to the risk-free rate of return, by comparing the earnings yields of S&P 500 companies to the 10Y treasury yields. "Earnings yield" refers to the net income attributable to shareholders divided by the stock's price - effectively the inverse of the PE ratio. The tangible meaning of this metric is "the annual income received by (attributable to) shareholders as a percent of the price paid to receive said income." Therefore, earnings yield is comparable to bond yields, which are "the annual income received by bond holders as a percent of the price paid to receive said income."
This indicator subtracts the earnings yield of S&P 500 companies from the current 10-year treasury bond yield, creating a "spread" between the yields that determines whether equities are currently an attractive investment relative to bonds. That is, if the S&P 500 earnings yield exceeds the 10Y treasury yield, then equity investors are receiving more attributable income per dollar paid than bondholders, which could be an indication that equities are an attractive purchase relative to the risk-free rate. The same applies vice-versa; if the 10Y treasury yield exceeds that of the S&P 500 earnings yield, then equities may not be an attractive investment relative to the risk-free rate.
Since data on S&P 500 companies' earnings yields are pulled on a monthly basis, this indicator should be used on a monthly timeframe or longer. Historical data has shown that the critical zones for the indicator are at -4% and +3%, i.e. when equities are trading with a 4% greater yield than 10Y T-bonds and when equities are trading with a 3% lower yield than 10Y T-bonds, respectively. In the "Oversold" case (-4%), equities are trading at a steep discount to the risk-free rate and has often represented a strong buying opportunity. In the "Overbought" case (+3%), equities are trading at a premium to the risk-free rate, which may be an indication that caution should be exercised within the stock market. When the indicator first crosses into "Oversold" territory, this has historically been near a the bottom of a crash on the S&P 500. When the indicator first crosses into the "Overbought" territory, this has often precipitated a correction of 15% on the S&P 500.
Some notable "misses," crashes that this indicator missed, include the 1973 stock market crash and the 2008 global recession. However, both of these cases were largely precipitated by unprecedented economic events, as opposed to stocks simply being "Overbought" relative to treasury yields. Nonetheless, this indicator should form only a small portion of your fundamental analysis, as there are many macroeconomic factors that could lead to major corrections besides the impact of treasury yields. Furthermore, it should also be noted that since markets are "forward looking," future earnings growth or interest rate hikes may become "priced into" both the stock and bond markets, affecting the outputs of this indicator. However, since both the stock and bond markets should account for these factors simultaneously, the impact has historically been minimized.
I hope you find this indicator to be beneficial to your strategies. Stay safe, and happy trading.
Fundamental-analysis
TradingGroundhog - Fundamental Analysis - Multiple RSI Ema(Script Available Version of my previous Fundamental Analysis - Multiple RSI Ema )
As the number of crypto currencies is expanding, we need to find the one which will boom in the next months, weeks or even days.
Therefore, I present to you a Fundamental Analysis tool based on RSI built in order to compare the RSI between the diverse cryptocurrencies.
When cryptocurrencies start to trend, become active, minable and especially "buyable", people are investing their money into them.
As a result,the Daily RSI rises and the price of the crypto in question increases steadily.
With "Fundamental Analysis - Multiple RSI EMA" you can :
Follow up to 20 RSI from different exchanges at the same time.
Find easily Increasing/Decreasing RSI as the lines get transparent if their RSI decrease.
You can also select market with high potential of booming as :
Booming Market : 60 < Daily RSI <= 100 (Strong green background)
Potent Market : 55 < Daily RSI <= 60 (Light green background)
Sleepy Market : 50 < Daily RSI <= 55 (Light red background)
Dying Market : 0 < Daily RSI <= 50 (Strong red background)
Futur booming crypto will go from the Potent Market to the Booming Market
Can be used with the following time frames depending on the necessity:
4H
Daily (Preferred)
Weekly
Monthly
Good trades !
Disclaimer (As it should always be one to any script)
***
This script is intended for and only to be used for personal purposes only. No such information provided by it constitutes advice or a recommendation for any investment or trading strategy for any specific person. There is no guarantee presented or implied as to the accuracy of specific forecasts, projections, or predictive statements offered by the script. Users of the script agree that its original developer does not take responsibility for any of your investment decisions. Please seek professional advice before trading.
***
© AlpHay : SECURITY FUNDAMENTAL TABLE// Equity Fundamental Data Report Table:
// Data Provider: Tradingview
// I am not a financial advisor or expert.
// This is my interpretation of this data. Consider this data doesn't represent the whole picture of what is going on!
// If you find some fundamentally wrong thinking about this approach, please inform me.
// I am open to suggestions. I am also looking for answers.
// Use it with a daily timeframe for data consistency.
// You can change or customize the threshold values whatever you want.
// www.tradingview.com
Percentile - Price vs FundamentalsThis is done in the same lines of below scripts
Drawdown-Price-vs-Fundamentals
Drawdown-Range
Instead of using drawdown, here we are only plotting percentile of drawdown. Also added few more fundamental stats to the indicator. Also using part of the code from Random-Color-Generator/ to automatically generate colors. This in turn uses code from @RicardoSantos for convering color based on HSL to RGB
This is how the study can be used:
Study plots percentile of price and each of the listed fundamentals based on history. History can be chose All time or particular window. If any fundamental or price is near 100 - which means it is nearer to its peak. And if something is near its bottom, it is nearer to its 0th percentile.
Price of the stock is considered undervalued based on historical levels when it is below most of the fundamentals. Price is considered overvalued based on historical levels when it is above all the fundamentals. Please note, being undervalued does not guarantee immediate mean reversion. Stocks can stay undervalued for prolonged time and can go further down. Similarly overvalued stock can stay overvalued for prolonged time before correcting itself or justifying the position. Hence, further discretion needs to be used while using this study.
Few examples:
AMZN seems to be trading in range and so are the fundamentals:
MSFT at peak along with half of the fundamentals. But, debt levels are going up along with margins reducing.
LPX is trading at 15% discount whereas most of the fundamentals are at the peak.
FLGT price seems to have gone down further whereas fundamentals look pretty healthy.
Drawdown RangeHello death eaters, presenting a unique script which can be used for fundamental analysis or mean reversion based trades.
Process of deriving this table is as below:
Find out ATH for given day
Calculate the drawdown from ATH for the day and drawdown percentage
Based on the drawdown percentage, increment the count of basket which is based on input iNumber of ranges . For example, if number of ranges is 5, then there will be 5 baskets. First basket will fit drawdown percentage 0-20% and each subsequent ones will accommodate next 20% range.
Repeat the process from start to last bar. Once done, table will plot how much percentage of days belong to which basket.
For example, from the below chart of NASDAQ:AAPL
We can deduce following,
Historically stock has traded within 1% drawdown from ATH for 6.59% of time. This is the max amount of time stock has stayed in specific range of drawdown from ATH.
Stock has traded at the drawdown range of 82-83% from ATH for 0.17% of time. This is the least amount of time the stock has stayed in specific range of drawdown from ATH.
At present, stock is trading 2-3% below ATH and this has happened for about 2.46% of total days in trade
Maximum drawdown the stock has suffered is 83%
Lets take another example of NASDAQ:TSLA
Stock is trading at 21-22% below ATH. But, historically the max drawdown range where stock has traded is within 0-1%. Now, if we make this range to show 20 divisions instead of 100, it will look something like this:
Table suggests that stock is trading about 20-25% below ATH - which is right. But, table also suggests that stock has spent most number of days within this drawdown range when we divide it by 20 baskets instad of 100. I would probably wait for price to break out of this range before going long or short. At present, it seems a stage ranging stage. I might think about selling PUTs or covered CALLs outside this range.
Similarly, if you look at AMEX:SPY , 36% of the time, price has stayed within 5% from ATH - makes it a compelling bull case!!
NYSE:BABA is trading at 50-55% below ATH - which is the most it has retraced so far. In general, it is used to be within 15-20% from ATH
NOW, Bit of explanation on input options.
Number of Ranges : Says how many baskets the drawdown map needs to be divided into.
Reference : You can take ATH as reference or chose a time window between which the highest need to be considered for drawdown. This can be useful for megacaps which has gone beyond initial phase of uncertainity. There is no point looking at 80% drawdown AAPL had during 1990s. More approriate to look at it post 2000s where it started making higher impact and growth.
Cumulative Percentage : When this is unchecked, percentage division shows 0-nth percentage instad of percentage ranges. For example this is how it looks on SPY:
We can see that SPY has remained within 6% from ATH for more than 50% of the time.
Hope this is helpful. Happy trading :)
PS: this can be used in conjunction with Drawdown-Price-vs-Fundamentals to pick value stocks at discounted price while also keeping an eye on range tendencies of it.
Thanks to @mattX5 for the ideas and discussion today :)
Drawdown - Price vs FundamentalsIn this study, we are trying to compare drawdown from ATH of price and fundamentals to understand if price drawdown is really justifyable or if this is the buying opportunity.
For example, NYSE:BABA in the chart below shows that price has come down by more than 50%. But, the fundamentals has not changed upto this extent.
This may be viewed as buying opportunity from the eyes of fundamental based trader.
Similarly NYSE:LPX is trading at 15% below ATH whereas fundamentals are at peak. This again can be considered as buying opportunity.
NASDAQ:AAPL on the other hand is trading almost near ATH whereas fundamentals are having higher drawdown.
Well, this is just one factor to consider. I am about to release another script which can demonstrate amount of time (in terms of percentage) instrument trades at certain drawdown range. This looks something like this:
These two scripts can be used in conjunction to define your fundamental based trade.
I can add more funcamentals to the list. But, the higher value of fundamental should correlate to better position. Hence we cannot use things such as PE (which inversely correlates to value). Also need to keep the factor which includes total number of shares in it so that it is not affected by share dilution. Hence, have considered Total Revenue per Share instead of Total Revenue in this script.
Thanks to @mattX5 for suggesting fundamental based ideas in this line :)
Fundamnetals + Strength + RiskManagementCreated indicator to help investors by providing fundamental, technical and Risk Management information on screen for better decision making
you can see
Fundamentals
- Solvency,
- Liquidity
- Growth,
- Profitability
- Patrioski Score
- Altman Z-Score
Technicals
- MAs
- Oscillators
Risk Management
- Position Size
- Stop Loss
- Total Investment
Relative Fundamental ComparisonWhen dealing with stocks, I like to review basic fundamentals of the company. This script displays the fundamental ratios of base chart stock with three other stocks (I can’t increase the number due to security function limitations). I found it particularly important when dealing with an unknown company. I quickly compare the company with other industry leaders to get a comparative fundamental review.
I am very new to Pinescript, so waiting for your comments and review.
Relative Growth ScreenBased on the Growth Range indicator published here:
Instead of plotting, they are printed in color coded table. Colors say whether the growth rate of these factors are relatively higher or lower.
Similar to quality screen, table positions can be customized.
If you have big enough screen, you can fit both quality and growth screens this way:
s3.tradingview.com
Value RangeHere is another attempt to chase value based on technical analysis.
This is extended version of PE range script published earlier.
Instead of just PE, this script contains several other factors which defines value. You can chose which factor to look at from input dialog:
Possible value factors included in this script are:
Price to Earnings
Price to Sales
Price to Book
PE - Forwarding
PS - Forwarding
Price to Cashflow
Enterprise Value to EBITDA
Enterprise Value to Cashflow
Some of these can be added to chart directly from financials. But, the script also calculate range based on donchian channel or bollinger bands. Instead of short periods, we are looking for periods in terms of years. Rest of things remain same.
ROE ValuationAn indicator that can be used to study ROE Valuation for stocks.
Red color means the market price is higher than the valuation whereas green color means the market price is below the valuation and it might be a good opportunity for value traders. Gray color indicates non-applicable results, when valuation is below zero for example.
PE ValuationAn indicator that can be used to study PE Valuation for stocks.
When the reported EPS for a company is non-positive the line turns gray. Red color means the market price is higher than the valuation whereas green color means the market price is below the valuation and it might be a good opportunity for value traders.
DCF ValuationAn indicator that can be used to study Discounted Cash Flow Valuation for stocks.
When the reported Free Cash Flow for a company is non-positive the line turns gray. Red color means the market price is higher than the valuation whereas green color means the market price is below the valuation and it might be a good opportunity for value traders.
Financial Highlights [Fundamentals]█ OVERVIEW
This indicator plot basic key financial data to imitate the presentation format of several popular finance site, make it easier for a quick glance of overall company financial health without switching tabs for every single stocks.
█ Financial Data Available:
- Revenue & PAT (Profit after Tax)
- Net Profit Margin (%)
- Gross Profit Margin (%)
- Earnings Per Share (EPS)
- Dividend
█ Features:
- Toggle between Quarter/Annual Financial Data (Notes: For Dividends, it will always be plotted based on Annual data, at Financial Year ending period)
- Options to plot at either at Quarter/Yearly ending period OR Financial Data published date
█ Limitation
- The accuracy of the data subject to Tradingview's source, but from my observation it's accurate 95% of the time
- Recently published data might not be available immediately. e.g. MYX exchange tends to have 1-3 days lag
- More information on Tradingview's financial data can be read here -> www.tradingview.com
█ Disclaimer
Past performance is not an indicator of future results.
My opinions and research are my own and do not constitute financial advice in any way whatsoever.
Nothing published by me constitutes an investment recommendation, nor should any data or Content published by me be relied upon for any investment/trading activities.
I strongly recommends that you perform your own independent research and/or speak with a qualified investment professional before making any financial decisions.
Any ideas to further improve this indicator are welcome :)
P1 FundamentalsP1 is because to me, this is a priority 1 indicator, so I have P1 and P2 indicators ordered on the favorite list.
What can you check on the selection pane?
On “period”, you can show the data related to:
the fiscal quarters
or the fiscal years.
You can select a pack of financial data that I have organized in sections:
Revenue & earnings
EPS & DPS (EPS, EPS estimate, DPS and dividend payout ratio )
Debt (total debt, total equity and cash & equivalents)
Returns (ROE, ROIC, ROA and R&D revenue to ratio)
I recommend to just select one of them, in other case the chart is a mess.
Any feedback on the code is welcome!!
Spitznagel Faustmann RatioThis is a rough version of the Faustmann Ratio metric that Mark Spitznagel presents in The Dao of Capital. The purpose is to conservatively calculate the price of the company (market cap) relative to net worth. Over a medium term horizon, the theory is that companies which have a high ROIC (see my other script) combined with a low Faustmann Ratio (color coded to give you a rough idea) should generally outperform. Please don't take this short summary as an excuse to not read the full book. It's well worth your time. (I am not affiliated with the author in any way.)
Spitznagel ROICThis is a rough version of the Return on Invested Capital metric that Mark Spitznagel presents in The Dao of Capital. The purpose is to calculate the return on real invested capital, conservatively calculated. Over a medium term horizon, the theory is that companies which have a high ROIC (presented here as a decimal value where 0.5 = 50%, 1 = 100%, etc., and color coded as a general guide) combined with a low Faustmann Ratio (see my other script) should generally outperform. Please don't take this short summary as an excuse to not read the full book. It's well worth your time. (I am not affiliated with the author in any way.)
Graham Net Current Asset Value per ShareNet current asset value per share (NCAVPS) is a measure created by Benjamin Graham as one means of gauging the attractiveness of a stock. A key metric for value investors, NCAVPS is calculated by taking a company's current assets and subtracting total liabilities.
NCAVPS = Current Assets - (Total Liabilities + Preferred Stock) ÷ Shares Outstanding.
According to Graham, investors will benefit greatly if they invest in companies where the stock prices are no more than 67% (or 2/3) of their NCAV per share (price <= (2/3)*NCAV).
Coloring pattern:
- price <= (1/3)*ncav -> light green
- (1/3)*ncav < price <= (2/3)*ncav -> green
- (2/3)*ncav < price <= ncav -> dim red
- price > ncav -> red
Long RSIThe RSI is a technical indicator generally used with the general setting being 14 days, and often shorter.
The accepted view is that a level of 70 indicates overbought conditions, and 30 indicates oversold conditions.
A short RSI setting will give signals quite often, and they might sometimes contradict each other.
As a individual investor, perhaps with a background in fundamental analysis, the RSI might be overlooked for other fundamental metrics.
But the idea here is that longer RSI settings can be used for investing.
The problem that arises is how to know when the indicator has reached a level that is either overbought or oversold.
This script solves that by using a specific look back period (selectable, but the standard is 1 year), and plotting the highest/lowest value that the RSI has had for that time period.
The idea is that a buy signal occurs when the indicator is at a 'historic' low, and a sell signal occurs when it at its 'historic' high.
Since you generally want to buy when the indicator is at its low, and has stopped decreasing, the script comes with a function that shows you when yesterdays value reached a historic low, but todays value is higher than yesterday.
This is shown by a color change of the background to green. The same is true, but opposite, for sell signals and then the background turns red.
THIS IS NOT TRADING ADVICE, AND YOU SHOULD ALWAYS DO YOUR OWN RESEARCH
GOOD LUCK AND HAPPY TRADING
Fundamental Metric to MarketThis script is supposed to be a quite basic way to find, from a fundamental standpoint, overvalue or undervalued stocks.
The script shows either Book to Market (inverse of P/B), EV /EBITDA, Earnings Yield (inverse of P/E) or Sales to Market (inverse of P/S).
For example, P/B is calculated as Close price / Book Value per share. As a contrarian investor you generally want to buy low P/B stocks and sell high P/B stocks. The problem is when a company has a negative Book Value. This might be the case when a company has written of a large amount of goodwill, which in turn wiped out their Book Value.
Instead you can use Book to Market, which is simply the inverse of P/B. It is calculated as Book Value per share / Close price. When using Book to Market you, generally, want to buy shares with high Book to Market values and sell those with low values. Because of the calculation, companies with negative Book Value will have negative Book to Market values and is therefore easy to identify.
The Fundamental Metric to Market indicator shows a colored background between the highest / lowest point of earlier values and the current value. When the background is mainly green the stock is probably undervalued, and the opposite is true when the background is red.
THIS IS NOT TRADING ADVICE, AND YOU SHOULD ALWAYS DO YOUR OWN RESEARCH
GOOD LUCK AND HAPPY TRADING
Graham NumberGraham Number is named after the “father of value investing,” Benjamin Graham, who was a mentor of Warren Buffett. The figure takes into account earnings per share and book value per share to measure a stock's maximum fair market value. In other words, it is the upper end of the price range that a defensive investor should pay for the stock.
The Graham Number = Square Root of (22.5) x (tmm EPS) x (mrq Book Value per Share).
The 22.5 is included in the formula as a rule of thumb to account for Graham's assumption that the price-to-earnings ratio should not be over 15 and the price to book ratio should not be over 1.5 for an undervalued stock. So, the number is generated as (P/E of 15) x (P/B of 1.5) = 22.5.
So the script generates a Graham number plot.
L1 Bitcoin Whale Pump DetectorLevel: 1
Background
One of the biggest differences between cryptocurrency and traditional financial markets is that cryptocurrency is based on blockchain technology. Individual investors can discover the direction of the flow of large funds through on-chain transfers. These large funds are often referred to as Whale. Whale can have a significant impact on the price movements of cryptocurrencies, especially Bitcoin. Therefore, how to monitor Whale trends is of great significance both in terms of fundamentals and technical aspects.
Function
L1 Bitcoin Whale Pump Detector script This is a simple technical indicator that judges whether Whale is involved in the relationship between price increase and trading volume. Its purpose is not to accurately judge Whale behavior, but to provide a starting point for more Pine lovers to develop more advanced Whale monitoring programs.
Key Signal
pumpcond1 use price information alone with 7% as a threshold
pumpcond2 use both price and volume infomation.
Pros and Cons
Pros:
1. Detect Whale pump in large time frame.
2. Not a mature and accurate buy and sell script but provide alerts of Whale movements.
3. When it resonante with Buy signal, it has higher confidence level.
Cons:
1. Only detect Whale Pump, not Whale Dump is realized.
2. Only provide large fund information, not an accurate trading signal generator.
Remarks
You can use this to confirm blockchain large fund transfer activities. E.g. Large amount of USDT flows into large exchanges.
Readme
In real life, I am a prolific inventor. I have successfully applied for more than 60 international and regional patents in the past 12 years. But in the past two years or so, I have tried to transfer my creativity to the development of trading strategies. Tradingview is the ideal platform for me. I am selecting and contributing some of the hundreds of scripts to publish in Tradingview community. Welcome everyone to interact with me to discuss these interesting pine scripts.
The scripts posted are categorized into 5 levels according to my efforts or manhours put into these works.
Level 1 : interesting script snippets or distinctive improvement from classic indicators or strategy. Level 1 scripts can usually appear in more complex indicators as a function module or element.
Level 2 : composite indicator/strategy. By selecting or combining several independent or dependent functions or sub indicators in proper way, the composite script exhibits a resonance phenomenon which can filter out noise or fake trading signal to enhance trading confidence level.
Level 3 : comprehensive indicator/strategy. They are simple trading systems based on my strategies. They are commonly containing several or all of entry signal, close signal, stop loss, take profit, re-entry, risk management, and position sizing techniques. Even some interesting fundamental and mass psychological aspects are incorporated.
Level 4 : script snippets or functions that do not disclose source code. Interesting element that can reveal market laws and work as raw material for indicators and strategies. If you find Level 1~2 scripts are helpful, Level 4 is a private version that took me far more efforts to develop.
Level 5 : indicator/strategy that do not disclose source code. private version of Level 3 script with my accumulated script processing skills or a large number of custom functions. I had a private function library built in past two years. Level 5 scripts use many of them to achieve private trading strategy.
Intrinsic value calculation Intrinsic value calculator based on Warren Buffet's and Ben Graham's work
In value investing determing the true value of a COMPANY instead of a stock price is crucial.
This little indicator shows the "Intrinsic value" of the choosen stock meaning the value of the stock in 10 years time. Calculation is based on historical book value's average annual growth rate and dividends paid.
Since this is about long therm investing, use monthly charts.
"Intrinsic value can be defined simply: It is the discounted value of the cash that can be taken out of a business during its remaining life.”
– Warren Buffett
One way to calculate that is by the growth in per share book value and dividends taken in the forseeable future (10 years) than discount it with the prevailing 10 year note's rate.
In the inputs you have to set 2 variables:
1. How many years back you have the first data for book value per share available?
2. What was the per share book value that year?
(Bookvalue is ploted in olive colour and you can get the oldest one if you move your cursor over the latest data on the left)
CAUTION! You have to reenter it for every stock you analyse as this is stock-specific data!
After setting the input data, you will see the "Intrinsic Value"'s pink curve ploted over the price chart.
If the price is well below the pink line, the company is undervalued and can be a possible applicant for long therm investment.
Margin of safety: when the current price is 50% below the intrinsic value that means a 10% yearly growth potential (100% growth in 10 years) or a 100% margin of safety.
I am a beginer in Pine so please excuse my coding...
If anybody knows hot to extract historical data from 15 years ago, please share it with me, so I can automate the whole calculation without inputs necessary.