Metals:Backwardation/ContangoMETALS: Gold , Silver , Copper ( GC , SI, HG)
Quickly visualize carrying charge market vs backwardized market by comparing the price of the next 2 years of futures contracts.
Carrying charge (contract prices increasing into the future) = normal, representing the costs of carrying/storage of a commodity. When this is flipped to Backwardation (contract prices decreasing into the future): its a bullish sign: Buyers want this commodity, and they want it NOW.
Note: indicator does not map to time axis in the same way as price; it simply plots the progression of contract months out into the future; left to right; so timeframe DOESN'T MATTER for this plot
There's likely some more efficient way to write this; e.g. when plotting for Gold ( GC ); 21 of the security requests are redundant; but they are still made; and can make this slower to load
TO UPDATE(once a year will do): in REQUEST CONTRACTS section, delete old contracts (top) and add new ones (bottom). Then in PLOTTING section, Delete old contract labels (bottom); add new contract labels (top); adjust the X in 'bar_index-(X+_historical)' numbers accordingly
This is one of three similar indicators: Meats | Metals | Grains
-If you want to build from this; to work on other commodities ; be aware that Tradingview limits the number of contract calls to 40 (hence the 3 seperate indicators)
Tips:
-Right click and reset chart if you can't see the plot; or if you have trouble with the scaling.
-Right click and add to new scale if you prefer this not to overlay directly on price. Or move to new pane below.
--Added historical input: input days back in time; to see the historical shape of the Futures curve via selecting 'days back' snapshot
updated 15th June 2022
© twingall
GOLD-SILVER
{Gunzo} Stock to Flow (Gold, Silver, Dollar, Bitcoin)This indicator displays the Stock to Flow (S2F) ratio for popular commodities (Gold, Silver, Dollar, Euro, Bitcoin, Ethereum) in order to
compare them and determine which ones could be a good Store of Value (SoV).
OVERVIEW :
Stock to Flow is a popular indicator used to predict commodities scarcity. It evaluates the total stock of a commodity against the total amount that can be produced during a year. This model supposes that if scarcity is increasing, the price is going to increase.
This model has been used over the last years on Bitcoin to determine if the asset was undervalued or overvalued, and even make prediction models on the future price.
This script is going to focus on the Stock to Flow ratio (total stock/amount produced) to compare the following assets over time :
Mining resources (mined) for Gold and Silver
Cryptos assets (mined) for Bitcoin and Ethereum
FIAT currencies (banknotes printed) for Dollar and Euro
CALCULATION :
The calculation of the Stock to Flow ratio evaluates the total stock of a commodity produced against the production made for a specific year. The data is calculated on a yearly basis, then interpolated to get monthly or daily values.
DATA ORIGIN :
The main information needed to calculate the Stock to Flow ratio is the "yearly production" of a commodity. I tried to retrieve that information from the most reliable sources :
for Gold from research on www.gold.org
for Silver from research on www.silverinstitute.org
for Ethereum from research on etherscan.io
for Bitcoin from data source "QUANDL:BCHAIN/TOTBC" from www.quandl.com
for Dollar from research on www.federalreserve.gov
for Euro from research on www.ecb.europa.eu
SETTINGS :
Smoothing for interpolated data : Smoothing factor for assets that are calculated yearly and then interpolated (Gold, Silver, Dollar, Euro, and Ethereum)
Smoothing for non interpolated data : Smoothing factor for assets that are calculated daily and not interpolated (Bitcoin)
Display asset names : Display assets names in a colored rectangle on the right side of the chart
Display asset values : Display assets Stock to Flow ratio in a colored rectangle on the right side of the chart
Display key events for assets : Display important events for the assets at the bottom of the chart using the same color as the assets lines (for example Orange diamond is a Bitcoin halving). Please refer to the script code for the details of all events.
USAGE :
This script can be used on any asset available on TradingView as the data used is either static or external.
However I recommend using it the Gold asset from currency.com as the depth of the chart will be bigger (since 1980s).
It is recommended to used this script on the monthly timeframe as the chart data is calculated yearly and then interpolated.