Cantom Chart - CL CTG vs BKDEnglish : This Pine Script indicator, named "Cantom Chart - CL CTG vs BKD," uniquely analyzes the immediate state of oil futures contracts to determine if they are in contango or backwardation. The script uses the price ratio between the nearest (CL1) and the next nearest (CL2) NYMEX crude oil futures contracts. It multiplies this ratio by 100 for clarity and scales fluctuations for enhanced visibility.
Key Features:
Dynamic Ratio Calculation: Computes the ratio (CL1/CL2 * 100) to determine the immediate market state.
Market State Interpretation: A ratio above 100 indicates backwardation, suggesting higher demand than supply, while a ratio below 100 indicates contango, suggesting higher supply than demand.
Volatility Adjustment: Amplifies market state changes by tripling the deviation from the baseline of 100, making it easier to observe subtle shifts.
Anomaly Detection: Caps the adjusted ratio at 125 for highs and 75 for lows, maintaining these limits until the ratio returns to normal levels.
Usage: This indicator is especially useful for traders analyzing supply-demand dynamics and inflationary pressures in the oil market. To apply it, simply add the script to your TradingView chart and adjust the 'Lower Threshold' and 'Upper Threshold' lines as needed based on your trading strategy.
-----
日本語 : この「Cantom Chart - CL CTG vs BKD」Pine Scriptインジケーターは、直近の原油先物契約がコンタンゴまたはバックワーデーションにあるかを特定するための独自の分析を提供します。最近の(CL1)と次の(CL2)NYMEX原油先物契約間の価格比を使用し、この比率に100を掛けて明確性を高め、変動の視認性を向上させます。
主要機能:
動的比率計算: 市場の即時状態を判断するために比率(CL1/CL2 * 100)を計算します。
市場状態の解釈: 比率が100を超える場合はバックワーデーション(需要が供給を上回る)、100未満の場合はコンタンゴ(供給が需要を上回る)を示します。
変動調整: 基準値100からの偏差を3倍にして、微妙な変化を容易に観察できるようにします。
異常値検出: 調整された比率を高値で125、低値で75に制限し、通常のレベルに戻るまでこれらの限界を維持します。
使用方法: このインジケーターは、原油市場における需給ダイナミクスとインフレ圧力を分析するトレーダーにとって特に有用です。使用するには、このスクリプトをTradingViewチャートに追加し、トレーディング戦略に基づいて「Lower Threshold」と「Upper Threshold」のラインを必要に応じて調整します。
Contango
Binance Auto Spot-Futures Premium/Discount -CheThis Script is based in the 2020 @Plumptoiletduck script
Special thanks to @tartigradia for the Auto Detect code for the Binance pair.
It tells us the difference in price between Spot and Perpetual Futures.
Now I incorporated the function that automatically detects the pair we are in to show the premium/discount of that pair.
You never need to select the currency you are in the script anymore!
It is specially designed for Binance coins, it includes all perpetuals.
How to use it?
Usually if the Futures are higher than the Spot it indicates that we are in an over exposure zone of longs in futures.
If the spot is cheaper than the futures it means that the futures are more fearful.
You can use this script with an Open Interest script to get an idea of what is going on.
Other examples:
Crude Oil: Backwardation Vs ContangoCrude Oil, CL
Plots Futures Curve: Futures contract prices over the next 3.5 years; to easily visualize Backwardation Vs Contango(carrying charge) markets.
Carrying charge (contract prices increasing into the future) = normal, representing the costs of carrying/storage of a commodity. When this is flipped to Backwardation(As the above; contract prices decreasing into the future): it's 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
TO UPDATE (every year or so): 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 several similar Futures Curve indicators: Meats | Metals | Grains | VIX | Crude Oil
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 multiple 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.
-If this takes too long to load (due to so many security calls); comment out the more distant future half of the contracts; and their respective labels. Or comment out every other contract and every other label if you prefer.
--Added historical input: input days back in time; to see the historical shape of the Futures curve via selecting 'days back' snapshot
updated 20th June 2022
© twingall
VIX: Backwardation Vs ContangoVIX: Backwardation Vs Contango
Quickly visualize Contango vs Backwardation in the S&P 500 Volatility Index by plotting the prices of the futures contracts over the next 9 months
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
TO UPDATE(every few months recommended): 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 several similar indicators: Meats | Metals | Grains | VIX
Tips:
-Right click and reset chart if you can't see the plot; or if you have trouble with the scaling.
-Right click and pin to Scale A to plot on the same scale as price
--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
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
Grains:Backwardation/ContangoGRAINS: Wheat , Soybeans , Corn (ZW, ZS, ZC )
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.
The above chart shows a nice example of backwardation.
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 Wheat (ZW); 15 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
Meats: Backwardation/CantangoMEATS: Live Cattle , Feeder Cattle, Lean Hogs (LE, GF , HE)
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 Live Cattle (LE); 8 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
Exchanges [Intromoto]This indicator shows the popular crypto exchanges for Bitcoin spot and futures . This allows you to not have all of the "compare" indicators on the chart, as this combines it all in one.
This indicator can be useful to show contango or backwardation between spot and derivative prices via exchange, giving potential indication for funding and reversal. Based on resolution restrictions, this will only show down to the 1 minute price.
I'll be updating it with more exchanges as I see fit.
BTC Volume Contango IndexBased on my previous script "BTC Contango Index" which was inspired by a Twitter post by Byzantine General:
This is a script that shows the contango between spot and futures volumes of Bitcoin to identify overbought and oversold conditions. When a market is in contango, the volume of a futures contract is higher than the spot volume. Conversely, when a market is in backwardation, the volume of the futures contract is lower than the spot volume.
The aggregate daily volumes on top exchanges are taken to obtain Total Spot Volume and Total Futures Volume. The script then plots (Total Futures Volume/Total Spot Volume) - 1 to illustrate the percent difference (contango) between spot and futures volumes of Bitcoin. This data by itself is useful, but because aggregate futures volumes are so much larger than spot volumes, no negative values are produced. To correct for this, the Z-score of contango is taken. The Z-score (z) of a data item x measures the distance (in standard deviations StdDev) and direction of the item from its mean (U):
Z-score = (x - U) / StDev
A value of zero indicates that the data item x is equal to the mean U, while positive or negative values show that the data item is above or below the mean (x Values of +2 and -2 show that the data item is two standard deviations above or below the chosen mean, respectively, and over 95.5% of all data items are contained within these two horizontal references). We substitute x with volume contango C, the mean U with simple moving average ( SMA ) of n periods (50), and StdDev with the standard deviation of closing contango for n periods (50), so the above formula becomes: Z-score = (C - SMA (50)) / StdDev(C,50).
When in contango, Bitcoin may be overbought.
When in backwardation, Bitcoin may be oversold.
The current bar calculation will always look incorrect due to TV plotting the Z-score before the bar closes.
BTC Contango IndexInspired by a Twitter post by Byzantine General:
This is a script that shows the contango between spot and futures prices of Bitcoin to identify overbought and oversold conditions. Contango and backwardation are terms used to define the structure of the forward curve. When a market is in contango, the forward price of a futures contract is higher than the spot price. Conversely, when a market is in backwardation, the forward price of the futures contract is lower than the spot price.
The aggregate prices on top exchanges are taken and then averaged to obtain a Spot Average and a Futures Average. The script then plots (Futures Average/Spot Average) - 1 to illustrate the percent difference (contango) between spot and futures prices of Bitcoin.
When in contango, Bitcoin may be overbought.
When in backwardation, Bitcoin may be oversold.
XBT % ContangoSimilar to my other indicators, but measures XBTUSD Contango in terms of percent.
Also, built it so you could change the values that give the red and green signals. Default values are 0% or less (backwardation) indicates green. However, i found that a 0.5% setting worked will finding local bottoms for current contract of XBTH20 (March 2020). The upper value default is at 5%, and signals red when the next contract reaches over 5%.
My assumption is as BTC increases in value over time, measuring contango in terms of percent will be a better measure of the XBT futures curve.
Bitmex BTC Backwardation / ContangoThis indicator calculates difference between price of Bitmex's XBTUSD, and Bitmex's two nearest futures.
If the difference is negative, then it is backwardation.
If the difference is positive, then it is contango.
This script will be updated every about 3 months, when the nearest Bitmex future will be expired.
This is an updated script of , with better description.
XBT Contango Calculator v1.1
This indicator measures value of basis (or spread) of current Futures contracts compared to spot. The default settings are specifically for Bitmex XBTU19 and XBTZ19 futures contracts. These will need to be updated after expiration. Also, it seems that Tradingview does not keep charts of expired contracts. If anyone knows how to import data from previous expired contracts, please let me know. This historical data could be valuable for evaluating previous XBT futures curves.
Also, VERY important to understand is this indicator only works with Spot Bitcoin charts (XBTUSD, BTCUSD, etc). If you add this to any other asset chart, it would not be useful (unless you changed settings to evaluate a different Futures product).
Contango and Backwardation are important fundamental indicators to keep track of while trading Futures markets. For a better explanation, Ugly Old Goat had done several medium articles on this. Please check out link below for his latest article on the subject...
uglyoldgoat.com
Notes on chart above should explain most of what you need to know on to use this indicator. The zero line is the spot price on the chart, so a positive value means Futures are trading at a premium (or in Contango). You can set a value of extreme Contango which will give an alert as red background (default setting is +$500). Green background will appear when Futures are trading at a discount to spot (Backwardation).
Hope some people get some use out of this. This is my first attempt at coding anything, so any feedback would be greatly appreciated!
BTC Donations: 3CypEdvBcvVHbqzHUt1FDiUG53U7pYWviV
Premium/Discount (Input)Used to show Contango or Backwardation in futures contracts vs spot price. You can input your own tickers so can technically can be used to compare anything.
* In this example I'm showing Okex Quarterly contract vs Okex spot index price because it showcases it better.
* If you are using this after 2019 the default setting will not work because I set it to Bitmex which does not currently have a "current contract in front" ticker available.
It should be fairly self explanatory, but just ask below if you have any questions.
Contango-Backwardation-Buschi
English:
This script shows the difference between a future's continuous current contract (e. g. CL1!) and the continuous next contract (e. g. CL2!). Normally, the next contract is more expensive ("Contango" - shown in green). If the next contract is cheaper, the difference is negative ("Backwardation" - shown in red).
A change between Contango and Backwardation often corresponds with stronger price changes.
Deutsch:
Dieses Skript zeigt den Unterschied zwischen dem kontinuierlichen aktuellem Kontrakt eines Futures (z. B. CL1!) und dem kontinuierlichen Folgekontrakt (z. B. CL2!). Im Normalfall ist der Folgekontrakt teurer ("Contango" - angezeigt in grün). Wenn der Folgekontrakt billiger ist, ist die Differenz negativ ("Backwardation" - angezeigt in rot).
Ein Wechsel zwischen Contango und Backwardation korrespondiert häufig mit größeren Preisänderungen.
Change Per Period - Tom1traderwww.tradingview.com
Plots the values between current close and close (specified number of periods) ago. User chooses the period defaulted to 1 and the period of a simple moving average of the values in the series. Made this specifically to measure the drift of the VIX exchange traded funds VXX, UVXY and SVXY. The fact that they must drift can be strategic in trading.
In the chart example it shows that VXX drifts down usually between -$10 and -$20 over a 60 day period (eyeball) and that for a few days in February of 2017 it had drifted down -$75. To find a positive change (briefly) you can see you have to go back to November of 2016. If you use Heiken Ashi candles or ohlc bars or change between regular candles and these there is a set of variables in this code that lets you do that without changing your indicator results. Anyhow use it or any of the code if it helps you, good luck with your trading and keep smiling! (any feedback appreciated also :-) )
Index Vs Futures for OKEX Quarterly Contracts 5.0*****Please note that all old versions of this script are depreciated and will report incorrect data!*****
This "indicator" is made to display the history of the price difference between OKEX's quarterly contracts and the market that it is supposed to be tracking. Contango differences are natural, but it's nice to visualize how they change over time.
This update to this script brings in further functionality when OKEX changed the index that the futures contracts are based off of to remove chinese exchanges from the mix. This script reflects that change and crosses-over when that change was made.
The new index removed chinese exchanges which are (currently) trading at a significant discount which will give bad data when using my old code.
VIX Term Roll OscillatorMy implementtion of VIX term roll Oscillator according to the articles below
seekingalpha.com
vixcontango.wordpress.com
Hope it helps!
Daniel
VIX Contango OscillatorVIX Contango Oscillator as outlined in the following blog post
vixcontango.wordpress.com
By Daniel Xu