Bitcoin Halving Rainbow + S2F Model PriceOverview
The rainbow price line:
This script creates a colorful view of Bitcoin's price action, where different colors indicate the time until the next halving date. The color scale in the top right highlights what each main color group represents in terms of days until the next halving. Using historical data, the simple indication of days until the next halving has somewhat accurately predicted potential bottoms and tops of market cycles. Comparing current colors to previous cycles provides a rough view of where BTC is in its current cycle and what to expect going forward until the next halving date.
In addition to the colored price action, I have incorporated the stock-to-flow model price for Bitcoin.
The stock-to-flow (S2F) model price:
The stock-to-flow ratio is a calculation that aims to estimate how many years are required to produce the current stock of an asset, based on the current production rate. When applied to Bitcoin, we simply divide the total amount of bitcoins in circulation by the amount of bitcoins mined in a certain timeframe. Once we have this value, we can calculate a model price based on the stock-to-flow ratio. This S2F model price uses a 463-day moving average. Preston Pysh came up with this number as he believed Bitcoin cycles happen in three phases: bull run, correction, and a reversion to the mean. He estimated there are about 200,000 blocks per cycle, three phases per cycle, and ~144 blocks per day. Dividing all three gets us 463. I have removed 1,000,000 coins from this calculation to account for Satoshi's coins.
The process I took to plot this model price (credit to PlanB for originally creating this calculation):
-Declare constant variables for the halving period, starting block reward, and the number of coins Satoshi owns.
-Fetch the block index by using the request.security() function.
-Determine the number of halvings that have occurred by dividing the block index by the halving period.
-Calculate the current block reward by multiplying the initial block reward by 0.5 raised to the power of the number of halvings.
-Calculate the number of blocks mined per period (day or week) and derive the stock (total bitcoins in circulation minus Satoshi's coins) and flow (annual block rewards) from it.
-Calculate the S2F ratio by dividing the stock by the flow.
-Calculate the S2F model price by applying a mathematical formula (ModelPrice = exp(-1.84) * S2F to the power of 3.36) along with a 463-day moving average.
** Please note, due to the use of the 463-day MA, the first ~400 days of the S2F model price is not entirely accurate.
In addition to the above, I have added vertical lines on each halving date, along with labels that have a tooltip if you hover over them, which will show more information about that particular halving.
Important tips:
-This script has been designed to work on the 1-Day timeframe but can also work on the 1-Week timeframe. Any other timeframe will not accurately plot all the information due to the way I have developed the script.
-This script is best used on the ticker I have posted this on, "INDEX:BTCUSD". It can also work on "BLX" or "BITSTAMP:BTCUSD".
-Hide candles when using the script to just show the halving rainbow (hover over the symbol name in the top left and press the eye icon).
-Right-click the price scale and select "Scale price chart only" to get a better view of the plots.
-Right-click the price scale and select "Logarithmic."
-I will update the script as time goes on to show future halvings along with adjusting the next halving date as we get closer (if it changes).
Settings Menu:
Tooltips are included explaining what the settings do, but here's a quick summary:
-'Show Vertical Halving Lines?': Default is true. This allows the user to remove the vertical lines shown on each halving date.
-'Show Halving Labels?': Default is true. This allows the user to remove the info labels shown on each halving date.
-'Halving Line and Label Color': Default is white. This allows the user to change the color of the halving lines and labels to better fit their chart layout.
-'Show Stock to Flow Model Price?': Default is true. This allows the user to remove the S2F model price.
-'Stock to Flow Model Price Color': Default is white. This allows the user to change the color of the S2F model price to better fit their chart layout.
-'Draw Color Table?': Default is true. This allows the user to remove the color table in the top right of the chart.
-'Distance rainbow is away from actual price action': Default is 0 (Plots over candles). This allows the user to adjust where the halving rainbow is plotted if they would like to also see candles on the chart. (Use any value under 0.9)
Feel free to message me or comment on the post with any questions or issues!
Much more to come!
Thanks for reading, enjoy!
Stocktoflowmodelvalue
TrendTracers Bitcoin Stock to Flow ModelFor the best results, make sure to view this indicator on a bitcoin chart with a very long history (e.g. BNC:BLX)!
This model treats Bitcoin as being comparable to commodities such as gold, silver or platinum. These are known as ‘store of value’ commodities because they retain value over long time frames due to their relative scarcity. It is difficult to significantly increase their supply i.e. the process of searching for gold and then mining it is expensive and takes time. Bitcoin is similar because it is also scarce. In fact, it is the first-ever scarce digital object to exist. There are a limited number of coins in existence and it will take a lot of electricity and computing effort to mine the remaining coins still to be mined, therefore the supply rate is consistently low.
The stock-to-flow model predicts value changes in a straightforward manner. It compares an asset’s current stock to the rate of new production, or how much is produced in a year.
Calculation:
Take bitcoin production in a period, divide it by that period and then multiply by 365 to get the estimated yearly production and then calculate the stock to flow.
yearlyFlow = ((stockChange) / period ) * 365
stockToFlow = (stock - missingBitcoins) / yearlyFlow
Model Value = -1.84ᵉ * stockToFlow³.³⁶ (mathematical model to calculate the model price)
For more information about the calculations followed: stats.buybitcoinworldwide.com
Features:
Works on the Daily, Weekly and Monthly Timeframe.
Allows you to adjust between a 10-day period and a 463-day period.
Has the option to account for missing bitcoins, lets you adjust the amount of missing bitcoins.
The ability to toggle a standard deviation of the Model Value with a multiplier of 1, 2 or 3
Displays a Stock to Flow Deviation Ratio: If the Deviation Ratio is close to 0 it means the price of Bitcoin is close to the Model Value Line(or Stock to Flow Ratio). If the Deviation Ratio is close to 1 or -1, it means the price of bitcoin is near the selected deviation levels.
You can toggle between the Overlay version and the Oscillator version, default is on Oscillator version. If you want to switch: Untick Oscillator mode in the indicator settings, click on the three dots and select "move to existing pane above". Then click on the three dots again and select Pin to scale A. Done!
As a bonus: Now you can toggle a "1-year Realized Price" graph, while it's not officially part of the Stock to Flow Model it does share similar technicals about supply and scarcity. The 1-year Realized Price is the realized market cap divided by total amount of generated coins.
I just noticed that, while the color gradient function is pretty cool, it does not allow for end users to customize their colors after applying this indicator to their chart. Sorry!
Bitcoin Stock to FlowModeling Bitcoin's Value With Scarcity
The Stock to Flow model for Bitcoin suggests that Bitcoin price is driven by scarcity over time.
Bitcoin is the first scarce digital object the world has ever seen. It is scarce like silver & gold, and can be sent over the internet, radio, satellite etc. Bitcoin includes a mathematical mechanism to restrict its supply over time making it more rare as time goes on. Digital Scarcity.
In 2017 BTC exceeded the market capitalization of Silver. After the next halving in 2024, Bitcoin will become the hardest asset the world has ever seen, rarer than Gold.
There is only enough Bitcoin in the world for each person to own .0023 BTC. Because of this, Bitcoin's value should continue to rise over time.
Stock to Flow Model with Standard Deviation BandsThis Study takes the Stock to Flow Model for Bitcoin as presented by 100trillionUSD and smoothes it using an SMA. Then it calculates the close's standard deviation from it and displays the 2-Sigma Bands.
The stock to flow model seems to be one of the best predictions of Bitcoins price.
The standard deviation bands are supposed to show situations in which Bitcoin is significantly over- or under-bought.
Bitcoin Stock To Flow Model Value (fixed)This indicator shows the Bitcoin value based on the Stock To Flow Model by planB
Fixed version of the original script by yomofoV:
Split up into 2 seperate indicators so you can put it into two seperate panes. This is the S2F Model Value.
You can find the S2F Multiple indicator here: