OPEN-SOURCE SCRIPT

Open interest flow / quantifytools

Updated
- Overview

Open interest flow detects inflows (positions opening) and outflows (positions closing) using open interest and estimates delta (net buyers/sellers) for the flows. Users are able to choose any open interest source available on Tradingview, by default set to BTCUSDT OI fetched from Binance. Using historical open interest flows, bands depicting typical magnitude of flows are formed for benchmarking intensity of flows. On the inflow side, +1 represents average inflows while +2 represents 2x above average inflows, a level considered an extreme. In a vice versa manner, -1 represents average outflows while -2 represents 2x above average outflows. Extreme inflows indicate aggressive position opening, in other words exuberance. Extreme outflows on the other hand indicate forced exiting of positions, in other words liquidations.

- Concept

Open interest flow is calculated using position of OI source relative to its moving average (by default set to SMA 10), referred to as relative open interest from hereon. When relative OI is positive (open interest is above its moving average), new positions are considered to enter the market. When relative OI is negative (open interest is below its moving average), existing positions are considered to exit the market. Open interest delta (side opening/closing positions, either net buyers/sellers) is calculated using relative price in a similar fashion to relative OI, but using close of viewed symbol as source. Price is considered to be up when relative price is positive, down when relative price is negative. Using relative OI and relative price in tandem, the following assumptions are applied:

Price up, open interest up = longs entering market
Price down, open interest up = shorts entering market
Price down, open interest down = longs exiting market
Price up, open interest down = shorts exiting market

snapshot

Bands depicting magnitude of open interest flows are calculated using average turning points in relative OI. +1 and -1 represent levels where flows on average turn towards mean rather than continue to increase/decrease. These levels are then multiplied up to +2 and -2, representing two times larger deviations from the normal. When inflows are above 1, positions opening have reached a point where flows historically turn down. Therefore, anything above 1 would be abnormal amount of open interest entering, an extreme stretch being at 2 or above. Same logic applies to outflows, but in a vice versa manner (below -1 abnormal, extreme at -2)

Flow bursts further refine indications of aggressive inflows/outflows by taking into account change in open interest flows. Burst indications are activated when open interest is above its average turning point, coupled with a sufficient increase/decrease in flows simultaneously. Bursts are essentially a filtered version of abnormal flows and therefore a more reliable indication of exuberance/liquidations. Burst sensitivity can be adjusted via input menu, available in 5 settings. 1 sets OI burst requirements to loosest (more signals, more noise) while 5 sets OI burst requirements to strictest (less signals, less noise). Exact criteria applied to bursts can be viewed via input menu tooltip.

snapshot

- Features

Users can opt for OI source auto-select for CRYPTO/USDT pairs. When auto-select is enabled and another chart is opened, corresponding open interest source is automatically selected as long as requirements mentioned above are met.

snapshot

Open interest flows can be visualized as chart color, available separately for flow states and flow bursts.

snapshot

Relative price line and flow guidelines (reminders for flow interpretation) can be enabled via input menu. All colors are customizable.

- Alerts

Available alerts are the following:

- Abnormal long inflows/outflows
- Abnormal short inflows/outflows
- Abnormal inflows/outflows from either side

- Aggressive longs/shorts (flow burst up)
- Liquidated longs/shorts (flow burst down)
- Aggressive or liquidated longs/shorts

- Practical guide

Open interest as a standalone data point does not reveal which side is likely opening/exiting positions and how extreme the participant behavior is. Using the additional data provided by open interest flows, moments of greed and fear can be detected. Smart money does not short into dips and buy into rips. When buyers or sellers have participated in a large move and continue to show interest even when efforts are not rewarded at an already overextended price, participants are asking for trouble.

snapshot

Similar events can be observed when extreme outflows take place, indicating forced exits such as stop-losses triggering. When enough participants are forced out, price is likely to take the path of least resistance which is to the opposite direction.

snapshot
Release Notes
Fixed incorrect OI source when opting for auto-select on futures pairs.
Release Notes
Updated license
OIOpen InterestopeninterestdeltaopeninterestfloworderflowOscillatorsquantifytoolssentiment

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?


✨ Get instant access to Premium Toolstack for Free: Liquidity prints, Price based concepts and Liquidity composition

✨ Start 7-Day Free Trial: quantify.tools

Watch video tutorials covering our tools on Youtube ↓
Also on:

Disclaimer