Bitcoin Miner Extreme SellingThis script is for identifying extreme selling. Judging by the chart, Bitcoin miners often (not always) sell hard for two reasons: to take profit into parabolic price rises, or to stay solvent when the price is very low.
Extreme selling thus often coincides with long-term tops and bottoms in Bitcoin price. This can be a useful EXTRA data point when trying to time long-term Bitcoin spot or crypto equity investment (NOT advice, you remain responsible, etc). The difference between selling measured in BTC and in USD gives a reasonable idea of whether miners are selling to make a profit or to stay solvent.
CREDITS
The idea for using the ratio of miner outflows to reserves comes from the "Bitcoin Miner Sell Pressure" script by the pioneering capriole_charles.
The two request.security calls are identical. Another similarity is that you have to sum the outflows to make it make sense. But it doesn't make much difference, it turns out from testing, to use an average of the reserves, so I didn't. All other code is different.
The script from capriole_charles uses Bollinger bands to highlight periods when sell pressure is high, uses a rolling 30-day sum, and only uses the BTC metrics.
My script uses a configurable 2-6 week rolling sum (there's nothing magical about one month), uses different calculations, and uses BTC, USD, and composite metrics.
INPUTS
Rolling Time Basis : Determines how much data is rolled up. At the lowest level, daily data is too volatile. If you choose, e.g., 1 week, then the indicator displays the relative selling on a weekly basis. Longer time periods, obviously, are smoother but delayed, while shorter time periods are more reactive. There is no "real" time period, only an explicit interpretation.
Show Data > Outflows : Displays the relative selling data, along with a long-term moving average. You might use this option if you want to compare the "real" heights of peaks across history.
Show Data > Delta (the default): Only the difference between the relative selling and the long-term moving average is displayed, along with an average of *that*. This is more signal and less noise.
Base Currency : Configure whether the calculations use BTC or USD as the metric. This setting doesn't use the BTC price at all; it switches the data requested from INTOTHEBLOCK.
If you choose Composite (the default), the script combines BTC and USD together in a relative way (you can't simply add them, as USD is a much bigger absolute value).
In Composite mode, the peaks are coloured red if BTC selling is higher than USD, which usually indicates forced selling, and green if USD is higher, which usually indicates profit-taking. This categorisation is not perfectly accurate but it is interesting insomuch as it is derived from block data and not Bitcoin price.
In BTC or USD mode, a gradient is used to give a rough visual idea of how far from the average the current value is, and to make it look pretty.
USAGE NOTES
Because of the long-term moving averages, the length of the chart does make a difference. I recommend running the script on the longest Bitcoin chart, ticker BLX.
To use it to compare selling with pivots in crypto equities, use a split chart: one BLX with the indicator applied, and one with the equity of your choice. Sync Interval, Crosshair, Time, and Date Range, but not Symbol.
Phân tích Cơ bản
[Antipanicos] Year-over-Year YoY ChangeYear-over-year growth compares a company's recent financial performance with its numbers for the same month one year earlier. This is considered more informative than a month-to-month comparison, which often reflects seasonal trends.
Coin & market cap tableThis table was built specifically for the Crypto market.
It gives you a quick overview of the markets without having to scroll through numerous charts. The information is the overall markets daily change and the charts coins movement on a daily, weekly and monthly basis.
The weeks start on a Monday morning, the months start on the 1st of the month so this is last weeks data and last calendar months data.
It also gives you Bitcoins dominance. (Total2) you can change it to Bitcoin & Ethereum dominance (Total3)
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
BTC NEW ADDRESS MOMENTUM: OnchainThis is a new oscillator that works based on the momentum of new addresses in the Bitcoin blockchain. Use this oscillator on the daily time frame. This oscillator consists of 2 moving averages on the number of new addresses. 30-day and 365-day moving averages. The upward crossover of the number of new addresses is usually associated with the beginning of an upward trend, and the downward crossover is associated with the beginning of a downward trend on the price chart.
Economic Calendar (Import from Spreadsheet)This script draws vertical lines to mark Economic Calendar Events.
Datetime of events is defined by user in Settings via a standardized line of text.
Motivation for coding this script:
All traders should be aware of economic calendar events. At times, when you really need to pay attention to an upcoming major event, you might even decide to use the vertical-line drawing tool to mark it. However, this takes manual effort.
This script provides a solution to performing mundane tasks such as drawing vertical lines and dragging them ever so slightly, just to have them approximately aligned with exact time.
Parameters:
(1) Source data - String representation of collection of datetime referencing to Economic Calendar Events
(2) Line color, & (3) Width of line - For displaying vertical lines drawn by script.
Standardized format for Source Data :
Example:
If 'GMT;2022,6,1,14,0,0;2022,6,2,12,15,0;' is provided to PineScript, then two vertical lines will be drawn on June 6, 2022 according to the exact time in 'YYYY,MM,DD,hh,mm,ss' format at the specified timezone (GMT in this case).
Template for Source Data :
Included here, link below, is a shared Google Sheet that systematically processes Economic Calendar data provided in the 'Raw Data' tab.
drive.google.com
Users are advised to use their preferred methods* to format the string (for source data param.), and apply their own criteria to sort down the Events. (ie. only include Events of High Impact, etc.)
* Preferred methods (as mentioned above) does not mean being limited to using the template as provided in this post.
Bitcoin Miner Sell PressureBitcoin miners are in pain and now (November 2022) selling more than they have in almost 5 years!
Introducing: Bitcoin Miner Sell Pressure.
A free, open-source indicator which tracks on-chain data to highlight when Bitcoin miners are selling more of their reserves than usual.
The indicator tracks the ratio of on-chain miner Bitcoin outflows to miner Bitcoin reserves.
- Higher = more selling than usual
- Lower = less selling than usual
- Red = extraordinary sell pressure
Today , it's red.
What can we see now ?
Miners are not great at treasury management. They tend to sell most when they are losing money (like today). But there have been times when they sold well into high profit, such as into the 2017 $20K top and in early 2021 when Bitcoin breached $40K.
Bitcoin Miner Sell Pressure identifies industry stress, excess and miner capitulation.
Unsurprisingly, there is a high correlation with Bitcoin Production Cost; giving strong confluence to both.
In some instances, BMSP spots capitulation before Hash Ribbons. Such as today!
Minervini QualifierThe Minervini Qualifier indicator calculates the qualifying conditions from Mark Minervini’s book “Trade like a Stock Market Wizard”.
The condition matching is been shown as fill color inside an SMA 20day envelope curve.
If the envelope color is red, current close price is below the SMA20 and when blue, current close price is above the SMA20. The fill color can be transparent (not matching qualifying conditions), yellow (matching all conditions except close is still below SMA50), green (all conditions match, SMA200 trending for at least one month up) or blue (all conditions match, SMA200 trending up for at least 5 months)
As I wanted also to see which of the qualifying conditions match over time, I’ve added add. lines, each representing one conditions. If it matches, line color is blue, or red if not. Use the data windows (right side), so you know what line represents which condition. Can be turned on/off (default:on)
In addition, a relative strength is been calculated, to compare the stock to a reference index. It is just one possible way to calculate it, might be different to what Mark Minervini is using. If the shown value (top right) is above 100, stock performs better compared to reference index (can be set in settings), when below 100, stock performs worse compared to reference index. Can be turned on/off (default:on)
How to use it:
For more details, read Mark’s book and watch his videos.
Limitations:
It gives only useful information on daily timeframe
(No financial advise, for testing purposes only)
Net LiquidityThis is an indicator that plots Net Liquidity.
The Net Liquidity function is simply: Fed Balance Sheet - Treasury General Account - Reverse Repo Balance
Net Liquidity can be used to ball park how much money is in the system and how it will affect various markets' performance.
Its primary purpose is showing how to use the NetLiquidityLibrary
Big Whale Purchases and SalesBig Whale Purchases and Sales - plots big whale transactions on your chart!
People that hold more than 1% of a crypto currencies circulating supply are considered whales and have a huge influence on price, not just because they can move the market with their huge transactions, but also because other traders often track their wallets and follow their example. Taking a look at whale holdings, one can see why whale worship is so common in crypto: While Bitcoin has a relatively low whale concentration, many of the Top 100 Cryptocurrencies have whales control 60% or more of their circulating supply.
Integrating IntoTheBlock data, this script plots the transactions of these whales and, in strategy mode, copy trades them.
Features:
Strategy Mode: Switches the script between an indicator and a strategy.
Standard Deviations: The number of Standard Deviations that a transaction needs to surpass to be considered worth plotting. Setting this to 0 will show all whale transactions, higher settings will only show the biggest transactions.
Blockchain: The Chain on which Whale activity is tracked.
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.
Times-Revenue (Fundamental Metric)Times-revenue is calculated by dividing the selling price of a company by the prior 12 months revenue of the company. The result indicates how many times of annual income a buyer was willing to pay for a company.
In color Red: it shows the last annual metric calculated
In color Gray: it shows the last 4 quarters annualized results
Yield Curve (1-10yr)Yield curve of the 1-10 year US Treasury Bonds, with over 60 years of history.
The Yield Curve is the interest rate on the 10 year bond minus the 1 year bond.
When it inverts (crosses under 0) a recession usually follows 6-12 months later.
It's a great leading indicator to identify risk in the macroeconomic environment.
Yield curves can be constructed on varying durations. Using a 1-year as the short-term bond provides a slightly faster response than the 2-year bond; and the 1-year has more historical data on TradingView.
[ENT] IndicatorsИндикатор показывает:
Открытие и закрытие торговых сессий (KillZones) - Азия, Лондон, Нью-Йорк
Открытие дня
Хай и Лой предыдущего дня
Разделение дней недели и их отображение.
Используйте на здоровье)
Sessions Lines & BackgroundDisplay Asia, London & New York sessions as background colors or lines (for a cleaner chart).
SPX Fair Value Bands V2An updated version of the SPX Fair Value Bands script from dharmatech and based on the net liquidity concept by MaxJAnderson .
Now with full customization of parameters through the settings (Dialog Box) and allowing the options to the use of
1) Standard Bands based on Offsets of the Fair Value
2) Bollinger Bands
3) Keltner Channels
to better capture buy/sell areas rather than relying on noisy unreliably (and unevenly) updated data from the Treasury/Fed.
==================================
Net Liquidity's importance in the new post-COVID QE to QT regime as described MaxJAnderson
----------------
" In past cycles, size of Fed's balance sheet changed a lot, while TGA and RRP changed relatively little. So size of balance sheet roughly equated Net Liquidity.
(The Treasury General Account) TGA and (Reverse Repo) RRP didn't matter. They were rounding errors by comparison.
But starting in 2020, relative changes in TGA and RRP have been THREE TIMES LARGER than the change in size of the Fed's balance sheet. As result, changes in TGA and RRP have taken over as the primary drivers Net Liquidity.
This is new, and changes the game significantly. Again - the size of the Fed's balance sheet doesn't matter.
What matters is the portion of it that's available to circulate in the economy (Net Liquidity).
And ever since 2020, the Treasury and Reverse Repo have become what controls that. Not the size of Fed's balance sheet.
----------------
The idea that follows is simple,short when $SPX reaches extreme levels of overvaluation, and close out when SPX returns to being undervalued. Here's the formulas I currently use to determine fair value:
Fair Value = (Fed Bal Sheet - TGA - RRP)/1.1 - 1625
And here's the trading rules I currently follow:
Short when diff of $SPX - Fair Value > 350
Close when diff of $SPX - Fair Value < 150
When one of these rules is triggered upon market close on a given day, trades are entered at open of the following day "
Fed Net Liquidity Indicator (24-Oct-2022 update)This indicator is an implementation of the USD Liquidity Index originally proposed by Arthur Hayes based on the initial implementation of jlb05013, kudos to him!
I have incorporated subsequent additions (Standing Repo Facility and Central Bank Liquidity Swaps lines) and dealt with some recent changes in reporting units from TradingView.
This is a macro indicator that aims at tracking how much USD liquidity is available to chase financial assets:
- When the FED is expanding liquidity, financial asset prices tend to increase
- When the FED is contracting liquidity, financial asset prices tend to decrease
Here is the current calculation:
Net Liquidity =
(+) The Fed’s Balance Sheet (FRED:WALCL)
(-) NY Fed Total Amount of Accepted Reverse Repo Bids (FRED:RRPONTTLD)
(-) US Treasury General Account Balance Held at NY Fed (FRED:WTREGEN)
(+) NY Fed - Standing Repo Facility (FRED:RPONTSYD)
(+) NY Fed - Central Bank Liquidity Swaps (FRED:SWPT)
Yield Curve (2-10yr)Yield curve of the 2-10 year US Treasury Bonds, with over 50 years of history.
The Yield Curve is the interest rate on the 10 year bond minus the 2 year bond.
When it inverts (crosses under 0) a recession usually follows 6-12 months later.
It's a great leading indicator to identify risk in the macroeconomic environment.
Misery index strategyHi all,
It's bear market so let's have a look at the misery index.
Misery index = inflation(%) + unemployment (%)
It's only possible to use this chart on the monthly (as misery index is updated monthly), but just for fun I added a strategy to it. If misery index increases you short and you go long when MI decreases.
Enjoy
p.s. the band is pretty cool too
Rolling CAGR (Compound Annual Growth Rate)Simple and powerful Rolling CAGR (Compound Annual Growth Rate) script.
Works with daily, weekly, and monthly data. Do not work with data of hours, minutes, seconds, or customized time intervals.
You can change the rolling period, from the default (3 years) to any other period of years. Just change one value in the script.
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
Economic Calendar Events: FOMC, CPI, and moreThis script plots major events from the Economic Calendar that often correspond to major pivot points in various markets. It also includes built-in logic to retroactively adjust larger time intervals (i.e. greater than 1 hour) to be correctly aligned with the interval during which the event occurred.
Events are taken from the Economic Calendar and will be updated periodically at the following library:
The above library can be used to conveniently access date-related data for major Meetings, Releases, and Announcements as integer arrays, which can be used in other indicators. Currently, it has support for the following events:
FOMC Meetings
The FOMC meets eight times a year to determine the course of monetary policy. The FOMC's decisions are based on a review of economic and financial developments and its assessment of the likely effects of these developments on the economic outlook.
FOMC Minutes
The FOMC minutes are released three weeks after each FOMC meeting. The minutes provide a detailed account of the FOMC's discussion of economic and financial developments and its assessment of the likely effects of these developments on the economic outlook.
Producer Price Index (PPI) Releases
The Producer Price Index (PPI) measures changes in the price level of goods and services sold by domestic producers. The PPI is a weighted average of prices of a basket of goods and services, such as transportation, food, and medical care. PPI is a leading indicator of CPI.
Consumer Price Index (CPI) Releases
The Consumer Price Index (CPI) measures changes in the price level of goods and services purchased by households. The CPI is a weighted average of prices of a basket of consumer goods and services, such as transportation, food, and medical care. CPI is one of the most widely used measures of inflation.
Consumer Sentiment Index (CSI) Releases
The University of Michigan's Consumer Sentiment Index (CSI) is a measure of consumer attitudes about the economy. The CSI is based on a monthly survey of U.S. households and reflects the consumers' assessment of present and future economic conditions. The CSI is a leading indicator of consumer spending, which accounts for about two-thirds of U.S. economic activity.
Consumer Confidence Index (CCI) Releases
The Consumer Confidence Index is a survey that measures how optimistic or pessimistic consumers are regarding their expected financial situation.
Non-Farm Payroll (NFP) Releases
The Non-Farm Payroll (NFP) is a measure of the change in the number of employed persons, excluding farm workers and government employees. The NFP is a leading indicator of consumer spending, which accounts for about two-thirds of U.S. economic activity.
Financial MetricsGives a sneak peak into some of the important financial ratios described below:
1. P/E : price to earnings ratio (Green when P/E<15)
2. PEG: Price to earnings growth ratio (Green when PEG<1)
3. P/S: Price to sales ratio (Green when P/S<2)
4. EV/FCF: Enterprise Value to Free Cashflow ratio
5. OPM: Operating Profit Margin % (Green when OPM>15%)
6. D/E: Debt to equity ratio (Green when D/E<1)
7. ROE: Return on equity % (Green when ROE>15%)
8. Div_Yield: Dividend yield
Disclaimer: All the limits defined are based on the widely accepted general values, but are subjective to particular sector or group of stocks. For example IT stocks command higher valuation than cyclical stocks like metal. So Compare with other stocks of the same sector to reach any conclusion.