Open Interest Divergence (OI vs Price)
May 24, 2022

The Open Interest Divergence (OI vs Price) indicator identifies discrepancies between Open Interest and price action to detect potential trend reversals or continuations. By highlighting instances where Open Interest increases while price moves in a range or creates divergent extremes, it provides traders with insights into market participation and potential exhaustion.
Usage
The tool can be used to identify two primary types of divergences between Open Interest (OI) and price action:
- Regular Bullish OI Divergence: Occurs when the price makes a Lower Low while the Open Interest makes a Higher Low. This suggests that despite price reaching new lows, the underlying participation or commitment is strengthening, potentially signaling a bullish reversal.
- Hidden Bearish OI Divergence: Occurs when the price makes a Lower High while the Open Interest makes a Higher High. This indicates that more positions are being opened despite the price failing to surpass previous peaks, often signaling bearish pressure or a continuation of a downward move.
The indicator plots the raw Open Interest data alongside a Simple Moving Average (SMA). Traders can use the crossover between the OI and its MA to gauge changes in market momentum.
Details
The script retrieves Open Interest data using the request.security function, targeting the _OI ticker suffix. It allows users to calculate OI based on the number of contracts or the USDT value (notional value).
Divergence detection is based on pivot points found within a user-defined range. The script looks for pivot lows and highs in the OI data and compares them to the corresponding price levels at those specific points in time. If the conditions for divergence are met within the specified bar range, labels are plotted on the OI line.
Settings
- OI Contract: When enabled, the indicator uses the raw number of contracts for Open Interest calculations.
- OI USDT: When enabled, the indicator calculates the Open Interest value in USDT (Contracts * Price).
- OI MA Length: Sets the period for the Simple Moving Average calculated on the Open Interest data.
Find OI Divergence
- Right bar: The number of bars to the right of a pivot point required for confirmation.
- Left bar: The number of bars to the left of a pivot point required for confirmation.
- Max Range: The maximum number of bars allowed between two pivots to qualify for a divergence.
- Min Range: The minimum number of bars required between two pivots to qualify for a divergence.
FAQ
How do I access Open Interest Divergence (OI vs Price)?
You can get access on the LuxAlgo Library for charting platforms like TradingView, MetaTrader (MT4/MT5), and NinjaTrader for free.
What symbols does this work on?
This indicator is designed for symbols that have accessible Open Interest data, typically found in crypto perpetual futures and some traditional futures markets.
What does "DivOI" on the chart mean?
The "DivOI" label signifies that the script has detected a divergence between price and Open Interest based on your pivot and range settings. Green labels indicate bullish divergence, while red labels indicate hidden bearish divergence.
Free indicator
Get free access to this indicator on the platforms below.
Unlock the entire LuxAlgo Library
Every indicator, every strategy, full charts, and complete access to Quant — our AI agent.