OPEN-SOURCE SCRIPT
Initial Balance Volume Deficit [LuxAlgo]

The IB Volume Deficit indicator measures the relationship between Initial Balance (IB) volume and the volume traded during the remainder of the session to identify shifts in market participation, institutional conviction, and potential exhaustion.
🔶 USAGE
The indicator operates on the principle that the first 60 minutes of a trading session (the Initial Balance) often set the tone for the day, representing the period where institutional "price discovery" and large-scale orders are most prevalent. By tracking the cumulative volume during this period and subsequently subtracting the volume from the rest of the session, the script visualizes whether the "opening conviction" is being sustained or overwhelmed by subsequent market activity.
🔹 Volume Deficit and Trend Conviction
When the oscillator drops below the zero line, a "Volume Deficit" occurs. This signifies that the volume traded after the Initial Balance has exceeded the volume accumulated during the IB. This is a critical marker for trend traders; a deep deficit often confirms that the market has found a directional bias with enough sustained participation to overcome the initial opening volatility. If the deficit continues to grow (the oscillator moves further into negative territory), it suggests that late-session participants are aggressively following the trend established (or reversed) after the first hour.
🔹 No Deficit Detection & Market Psychology
If the oscillator remains above zero until the end of the session, the script highlights this at the start of the next session with a colored background. This "No Deficit" event indicates that the volume in the first hour was greater than the volume of the entire rest of the day combined.
From a psychological perspective, this represents a "Loud Open, Quiet Close" scenario. It suggests that while there was significant institutional interest or news-driven positioning at the open, it failed to attract follow-through participation from the broader market. This often results in:
🔹 Trading with the Anchored Moving Average (AMA)
The indicator includes an Anchored Moving Average (AMA) that resets at the start of each session. The relationship between the oscillator and the AMA provides a real-time gauge of volume momentum.
🔶 DETAILS
The indicator calculates a cumulative sum starting at the first bar of a new session. During the first 60 minutes (IB), the oscillator increases by the volume of each bar. After 60 minutes, the logic flips, and the volume of each subsequent bar is subtracted from the total.
🔹 Tops and Bottoms Averages
To provide historical context and act as dynamic benchmarks for volume conviction, the indicator plots two dashed horizontal lines:
🔶 SETTINGS
🔶 USAGE
The indicator operates on the principle that the first 60 minutes of a trading session (the Initial Balance) often set the tone for the day, representing the period where institutional "price discovery" and large-scale orders are most prevalent. By tracking the cumulative volume during this period and subsequently subtracting the volume from the rest of the session, the script visualizes whether the "opening conviction" is being sustained or overwhelmed by subsequent market activity.
🔹 Volume Deficit and Trend Conviction
When the oscillator drops below the zero line, a "Volume Deficit" occurs. This signifies that the volume traded after the Initial Balance has exceeded the volume accumulated during the IB. This is a critical marker for trend traders; a deep deficit often confirms that the market has found a directional bias with enough sustained participation to overcome the initial opening volatility. If the deficit continues to grow (the oscillator moves further into negative territory), it suggests that late-session participants are aggressively following the trend established (or reversed) after the first hour.
🔹 No Deficit Detection & Market Psychology
If the oscillator remains above zero until the end of the session, the script highlights this at the start of the next session with a colored background. This "No Deficit" event indicates that the volume in the first hour was greater than the volume of the entire rest of the day combined.
From a psychological perspective, this represents a "Loud Open, Quiet Close" scenario. It suggests that while there was significant institutional interest or news-driven positioning at the open, it failed to attract follow-through participation from the broader market. This often results in:
- Exhaustion: The initial move spent all available "fuel" in the first hour.
- Range-Bound Behavior: Without a volume deficit, the market likely spent the afternoon in a low-liquidity chop, unable to break the IB high or low.
- Lack of Retail Follow-through: It indicates that the initial institutional orders were met with indifference rather than a trend-following response.
🔹 Trading with the Anchored Moving Average (AMA)
The indicator includes an Anchored Moving Average (AMA) that resets at the start of each session. The relationship between the oscillator and the AMA provides a real-time gauge of volume momentum.
- Bullish Momentum: When the oscillator is above the AMA during the IB, it indicates an accelerating buildup of volume, often seen in high-impact opens.
- Bearish Momentum (Depletion): After the IB, if the oscillator crosses below the AMA, it suggests that volume is being subtracted (consumed) faster than the average rate. This can be used as a confirmation signal for entering trend trades as the market moves toward a deficit state.
🔶 DETAILS
The indicator calculates a cumulative sum starting at the first bar of a new session. During the first 60 minutes (IB), the oscillator increases by the volume of each bar. After 60 minutes, the logic flips, and the volume of each subsequent bar is subtracted from the total.
🔹 Tops and Bottoms Averages
To provide historical context and act as dynamic benchmarks for volume conviction, the indicator plots two dashed horizontal lines:
- Tops Average (Benchmark of Opening Strength): This is the average peak volume reached at the end of the IB over the last N sessions. If the current session's peak is significantly higher than this average, it suggests an unusually high-conviction opening, often triggered by major news or earnings. If the peak fails to reach this average, the session may lack the necessary liquidity for a sustained directional move.
- Bottoms Average (Benchmark of Session Intensity): This tracks the average final deficit value at the close of the last N sessions. It serves as a target or "support" level for volume. If the oscillator breaches this average to the downside, it signals an exceptionally high-conviction trend day that is outperforming historical norms.
🔶 SETTINGS
- Moving Average Length: Sets the smoothing period for the Anchored Moving Average (AMA). A shorter length makes the AMA more reactive to sudden bursts in volume.
- Tops/Bottoms Average Length: Determines the lookback period (in sessions) used to calculate the historical benchmarks for IB peaks and session-end deficits.
- Style Group:
- Bullish Color: Sets the color of the oscillator during the IB accumulation phase.
- Bearish Color: Sets the color of the oscillator once it enters a deficit (below zero) or starts subtracting volume.
- MA Color: Sets the color of the Anchored Moving Average line.
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
All content & scripts provided by LuxAlgo are for educational purposes only and are not financial advice.
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
All content & scripts provided by LuxAlgo are for educational purposes only and are not financial advice.
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。