TradingView
LuxAlgo
Jun 8, 2023 6:00 PM

Open Interest Chart [LuxAlgo] 

S&P 500SP

Description

â‹…
The Open Interest Chart displays Commitments of Traders %change of futures open interest, with a unique circular plotting technique, inspired from this publication Periodic Ellipses.

🔶 USAGE



Open interest represents the total number of contracts that have been entered by market participants but have not yet been offset or delivered. This can be a direct indicator of market activity/liquidity, with higher open interest indicating a more active market.

Increasing open interest is highlighted in green on the circular plot, indicating money coming into the market, while decreasing open interests highlighted in red indicates money coming out of the market.

You can set up to 6 different Futures Open interest tickers for a quick follow up:

🔶 DETAILS

Circles are drawn, using plot(), with the functions createOuterCircle() (for the largest circle) and createInnerCircle() (for inner circles).

Following snippet will reload the chart, so the circles will remain at the right side of the chart:

if ta.change(chart.left_visible_bar_time ) or ta.change(chart.right_visible_bar_time) n := bar_index


Here is a snippet which will draw a 39-bars wide circle that will keep updating its position to the right.

//@version=5 indicator("") n = bar_index barsTillEnd = last_bar_index - n if ta.change(chart.left_visible_bar_time ) or ta.change(chart.right_visible_bar_time) n := bar_index createOuterCircle(radius) => var int end = na var int start = na var basis = 0. barsFromNearestEdgeCircle = 0. barsTillEndFromCircleStart = radius startCylce = barsTillEnd % barsTillEndFromCircleStart == 0 // start circle bars = ta.barssince(startCylce) barsFromNearestEdgeCircle := barsTillEndFromCircleStart -1 basis := math.min(startCylce ? -1 : basis + 1 / barsFromNearestEdgeCircle * 2, 1) // 0 -> 1 shape = math.sqrt(1 - basis * basis) rad = radius / 2 isOK = barsTillEnd <= barsTillEndFromCircleStart and barsTillEnd > 0 hi = isOK ? (rad + shape * radius) - rad : na lo = isOK ? (rad - shape * radius) - rad : na start := barsTillEnd == barsTillEndFromCircleStart ? n -1 : start end := barsTillEnd == 0 ? start + radius : end [hi, lo, start +1, end] [h, l, s, e] = createOuterCircle(40) plot(h), plot(l)


🔶 LIMITATIONS

  • Due to the inability to draw between bars, from time to time, drawings can be slightly off.
  • Bar-replay can be demanding, since it has to reload on every bar progression. We don't recommend using this script on bar-replay. If you do, please choose the lowest speed and from time to time pause bar-replay for a second. You'll see the script gets reloaded.


🔶 SETTINGS

🔹 TICKERS

  • Toggle:
        • Enabled  -> uses the first column with a pre-filled list of Futures Open Interest tickers/symbols
        • Disabled -> uses the empty field where you can enter your own ticker/symbol

  • Pre-filled list: the first column is filled with a list, so you can choose your open interest easily, otherwise you would see COT:088691_F_OI aka Gold Futures Open Interest for example.
         If applicable, you will see 3 different COT data:
        • COT: Legacy Commitments of Traders report data
        • COT2: Disaggregated Commitments of Traders report data
        • COT3: Traders in Financial Futures report data

  • Empty field: When needed, you can pick another ticker/symbol in the empty field at the right and disable the toggle.

  • Timeframe: Commitments of Traders (COT) data is tallied by the Commodity ​Futures Trading Commission (CFTC) and is published weekly. Therefore data won't change every day.
         Default set TF is Daily


🔹 STYLE

  • From middle:
        • Enabled (default): Drawings start from the middle circle -> towards outer circle is + %change, towards middle of the circle is - %change
        • Disabled: Drawings start from the middle POINT of the circle, towards outer circle is + OR -
        -> in both options, + %change will be coloured green, - %change will be coloured red.
        -> 0 %change will be coloured blue, and when no data is available, this will be coloured gray.

  • Size circle: options tiny, small, normal, large, huge.

  • Angle: Only applicable if "From middle" is disabled!
        -> sets the angle of the spike:
  • Show Ticker: Name of ticker, as seen in table, will be added to labels.

  • Text - fill
        • Sets colour for +/- %change
  • Table
        • Sets 2 text colours, size and position

  • Circles
        • Sets the colour of circles, style can be changed in the Style section.
           You can make it as crazy as you want:
Comments
PineCoders
â‹…
In the name of all TradingViewers, thank you for your valuable contribution to the community, and congrats!
LuxAlgo
â‹…
@PineCoders, Much appreciated!
GG8990
â‹…
@LuxAlgo, does this open interest chart get updated daily and what time for the open interest across the different asset classes?
quantifytools
â‹…
A very interesting implementation. Thanks for sharing!
LuxAlgo
â‹…
@quantifytools, Cheers, thank you!
RozaniGhani-RG
â‹…
good hardwork
StudentOfCharts
â‹…
Very interesting cool tool. Is there a FAQ sheet explaining this tool?
dgtrd
â‹…
amazing visualizations, true art and great content
LuxAlgo
â‹…
@dgtrd, 🔥🔥🔥
fikira
â‹…
@dgtrd, 💙
More