OPEN-SOURCE SCRIPT
Volume Defense Zones [MarkitTick]

💡 The Volume Defense Zones [MarkitTick] is a professional-grade liquidity analysis engine designed to identify institutional interest by isolating ultra-high volume transactions and mapping them as dynamic support and resistance zones. Unlike standard volume indicators that merely plot vertical bars, this script utilizes a sophisticated heatmap engine and a multi-timeframe (MTF) overlay to provide a three-dimensional view of market participation. By calculating the Volume Weighted Average Price (VWAP) specifically for high-intensity bars, the indicator creates "Defense Zones"—price levels where large-scale players have historically committed significant capital.
● ✨ Originality and Utility
This indicator distinguishes itself from the vast library of open-source tools through its unique "Search Depth" logic and automated zone merging capabilities. While many scripts identify volume spikes, they often clutter the chart with overlapping lines that lose relevance over time. This system solves that problem by:
• Dynamic Zone Consolidation
The script includes a proprietary merge threshold algorithm. If two high-volume defense levels are within a user-defined percentage of each other, the script automatically merges them into a single "Defense Box." This reflects the reality of market "zones" rather than surgical price points.
• Multi-Timeframe Institutional Benchmarking
By integrating a built-in MTF overlay, traders can visualize 4-hour or Daily volume defense zones while trading on a 5-minute chart. This ensures that the user is always aware of the "Big Picture" liquidity levels that are likely to hold during intraday volatility.
• Historical Ghosting and Breakout Analysis
The script tracks whether a zone is "active" or "broken." When price breaches a defense level, the zone doesn't simply disappear; it transforms into a "Ghost Zone" (dotted line), allowing traders to analyze S/R flips and historical retests of previously defended levels.
● 🔬 Methodology and Concepts
The core logic of the Volume Defense Zones is rooted in the identification of "Abnormal Volume" relative to a historical lookback period.
• Peak Volume Identification
The script maintains a rolling window of volume data defined by the "Comparison Length" input. A bar is classified as "Ultra High Volume" only if its volume exceeds the maximum volume recorded in that lookback window. This ensures that the signals adapt to changing market regimes (e.g., high-volatility sessions vs. low-volume holidays).
• The Defense Calculation
For every identified volume peak, the script calculates a localized VWAP using the internal formula:
Accumulated (Volume * Bar Body Center) / Total Volume.
This price level represents the "Average Cost Basis" of the participants during that specific high-intensity event. If the price remains above this VWAP, the level is treated as a Bullish Defense (Support). If price stays below it, it is a Bearish Defense (Resistance).
• Multi-Timeframe (MTF) Security
Using the request.security function with barmerge.lookahead_on (and appropriate offsets to prevent repainting), the script fetches high-volume levels from higher timeframes. This provides a top-down liquidity map that identifies where large institutions are "defending" their positions.
● 🎨 Visual Guide
The visual output is divided into three primary categories to ensure maximum clarity and actionable data visualization:
• The Volume Heatmap (Bottom Pane)
Instead of standard green and red bars, this script uses a professional 5-color heatmap gradient:
- Deep Blue (HM_C0): Low interest / baseline volume.
- Teal/Cyan (HM_C1/HM_C2): Rising interest.
- Gold (HM_C3): High participation.
- Bright Red (HM_C4): Ultra-High Volume.
These bars are framed with thicker borders when a new peak is detected, making the "Ultra Vol" events immediately visible.
• Defense Zones and Labels
- Green Boxes (ZONE_BULL_COL): Represent active bullish defense zones where buyers are currently in control of the high-volume level.
- Red Boxes (ZONE_BEAR_COL): Represent active bearish defense zones where sellers are successfully defending the level.
- Blue/Neutral Boxes (ZONE_INSIDE_COL): Represent zones where the price is currently trading inside the defense range, indicating a period of consolidation or "battle."
- Dotted Lines/Boxes: These are "Broken" or "Ghost" zones. They indicate levels that were previously significant but have been breached.
• Trend Climax Indicators
The script plots specific triangles on the volume bars:
- Green Up Triangle (▲): Bullish Climax. Occurs when price is trending down but a high-volume reversal is detected above the VWAP.
- Red Down Triangle (▼): Bearish Climax. Occurs when price is trending up but a high-volume rejection is detected below the VWAP.
• Professional Dashboard
A clean table in the top-right corner displays real-time statistics, including Total Volume, Max Volume, Average Volume, and the total count of analyzed bars.
● 📖 How to Use
● ⚙️ Inputs and Settings
• Volume Settings
- Time Resolution: Allows you to change the granularity of the volume analysis.
- Comparison Length: Defines the lookback period (default 20) for determining what constitutes a "Peak" volume bar.
• Visual & Analysis
- Search Depth (Levels): Controls how many historical S/R zones are displayed on the chart. Increasing this provides more historical context but may clutter the view.
- Merge Threshold (%): A critical setting that defines how close two price levels must be to be grouped into a single zone.
- Show All Data Labels: Toggles the display of exact volume figures above the bars.
• Multi-Timeframe Overlay
- HTF Timeframe: Set the higher timeframe (e.g., 240 for 4-hour) to see macro defense zones.
- Max HTF Zones: Limits the number of MTF lines drawn to keep the chart clean.
● 🔍 Deconstruction of the Underlying Scientific and Academic Framework
The indicator is constructed upon the principles of **Auction Market Theory (AMT)** and **Volume Spread Analysis (VSA)**.
• Auction Market Theory
The fundamental premise is that the market is an ongoing auction where the purpose of price is to find the area where the most volume can be transacted. The "Defense Zones" calculated by this script represent "High Volume Nodes" (HVN). Scientifically, these are levels of high price acceptance. When price moves away from these zones and returns, the script tests whether the "Value" has shifted or if the previous participants are still willing to transact at that level.
• Statistical Outlier Theory
The "Ultra High Volume" detection utilizes a non-parametric approach to identify outliers. By comparing the current volume to the rolling maximum of the previous $N$ periods, the script effectively identifies events that fall outside the standard distribution of market activity. This is mathematically equivalent to identifying "Z-score" spikes in volume, signifying a significant shift in market sentiment or the injection of institutional liquidity.
• Volume Weighted Cost Basis (VWCB)
The use of VWAP within the defense zones is based on the academic concept of the "Volume Weighted Cost Basis." In institutional finance, the execution quality of a large trade is measured against the VWAP. Therefore, these levels act as psychological and financial "anchors" for large participants who need to protect their average entry price to maintain a profitable position.
⚠️ Disclaimer
All provided scripts and indicators are strictly for educational exploration and must not be interpreted as financial advice or a recommendation to execute trades. I expressly disclaim all liability for any financial losses or damages that may result, directly or indirectly, from the reliance on or application of these tools. Market participation carries inherent risk where past performance never guarantees future returns, leaving all investment decisions and due diligence solely at your own discretion.
● ✨ Originality and Utility
This indicator distinguishes itself from the vast library of open-source tools through its unique "Search Depth" logic and automated zone merging capabilities. While many scripts identify volume spikes, they often clutter the chart with overlapping lines that lose relevance over time. This system solves that problem by:
• Dynamic Zone Consolidation
The script includes a proprietary merge threshold algorithm. If two high-volume defense levels are within a user-defined percentage of each other, the script automatically merges them into a single "Defense Box." This reflects the reality of market "zones" rather than surgical price points.
• Multi-Timeframe Institutional Benchmarking
By integrating a built-in MTF overlay, traders can visualize 4-hour or Daily volume defense zones while trading on a 5-minute chart. This ensures that the user is always aware of the "Big Picture" liquidity levels that are likely to hold during intraday volatility.
• Historical Ghosting and Breakout Analysis
The script tracks whether a zone is "active" or "broken." When price breaches a defense level, the zone doesn't simply disappear; it transforms into a "Ghost Zone" (dotted line), allowing traders to analyze S/R flips and historical retests of previously defended levels.
● 🔬 Methodology and Concepts
The core logic of the Volume Defense Zones is rooted in the identification of "Abnormal Volume" relative to a historical lookback period.
• Peak Volume Identification
The script maintains a rolling window of volume data defined by the "Comparison Length" input. A bar is classified as "Ultra High Volume" only if its volume exceeds the maximum volume recorded in that lookback window. This ensures that the signals adapt to changing market regimes (e.g., high-volatility sessions vs. low-volume holidays).
• The Defense Calculation
For every identified volume peak, the script calculates a localized VWAP using the internal formula:
Accumulated (Volume * Bar Body Center) / Total Volume.
This price level represents the "Average Cost Basis" of the participants during that specific high-intensity event. If the price remains above this VWAP, the level is treated as a Bullish Defense (Support). If price stays below it, it is a Bearish Defense (Resistance).
• Multi-Timeframe (MTF) Security
Using the request.security function with barmerge.lookahead_on (and appropriate offsets to prevent repainting), the script fetches high-volume levels from higher timeframes. This provides a top-down liquidity map that identifies where large institutions are "defending" their positions.
● 🎨 Visual Guide
The visual output is divided into three primary categories to ensure maximum clarity and actionable data visualization:
• The Volume Heatmap (Bottom Pane)
Instead of standard green and red bars, this script uses a professional 5-color heatmap gradient:
- Deep Blue (HM_C0): Low interest / baseline volume.
- Teal/Cyan (HM_C1/HM_C2): Rising interest.
- Gold (HM_C3): High participation.
- Bright Red (HM_C4): Ultra-High Volume.
These bars are framed with thicker borders when a new peak is detected, making the "Ultra Vol" events immediately visible.
• Defense Zones and Labels
- Green Boxes (ZONE_BULL_COL): Represent active bullish defense zones where buyers are currently in control of the high-volume level.
- Red Boxes (ZONE_BEAR_COL): Represent active bearish defense zones where sellers are successfully defending the level.
- Blue/Neutral Boxes (ZONE_INSIDE_COL): Represent zones where the price is currently trading inside the defense range, indicating a period of consolidation or "battle."
- Dotted Lines/Boxes: These are "Broken" or "Ghost" zones. They indicate levels that were previously significant but have been breached.
• Trend Climax Indicators
The script plots specific triangles on the volume bars:
- Green Up Triangle (▲): Bullish Climax. Occurs when price is trending down but a high-volume reversal is detected above the VWAP.
- Red Down Triangle (▼): Bearish Climax. Occurs when price is trending up but a high-volume rejection is detected below the VWAP.
• Professional Dashboard
A clean table in the top-right corner displays real-time statistics, including Total Volume, Max Volume, Average Volume, and the total count of analyzed bars.
● 📖 How to Use
- Identifying Institutional Support: Look for thick green boxes formed during "Ultra High Vol" events. These are areas where price is likely to bounce upon a retest.
- Trading the Breakout: When a red resistance zone is breached and turns into a dotted "Ghost" zone, wait for a retest of that level. If price holds above it, the old resistance has become new support.
- Filtering with MTF: Only take long trades when the price is above the Purple MTF lines, which represent the higher-timeframe institutional defense levels.
- Exhaustion Signals: Use the Climax Triangles (▲/▼) to identify potential trend reversals. A red triangle at the end of a long uptrend often signals that "smart money" is distributing their positions.
● ⚙️ Inputs and Settings
• Volume Settings
- Time Resolution: Allows you to change the granularity of the volume analysis.
- Comparison Length: Defines the lookback period (default 20) for determining what constitutes a "Peak" volume bar.
• Visual & Analysis
- Search Depth (Levels): Controls how many historical S/R zones are displayed on the chart. Increasing this provides more historical context but may clutter the view.
- Merge Threshold (%): A critical setting that defines how close two price levels must be to be grouped into a single zone.
- Show All Data Labels: Toggles the display of exact volume figures above the bars.
• Multi-Timeframe Overlay
- HTF Timeframe: Set the higher timeframe (e.g., 240 for 4-hour) to see macro defense zones.
- Max HTF Zones: Limits the number of MTF lines drawn to keep the chart clean.
● 🔍 Deconstruction of the Underlying Scientific and Academic Framework
The indicator is constructed upon the principles of **Auction Market Theory (AMT)** and **Volume Spread Analysis (VSA)**.
• Auction Market Theory
The fundamental premise is that the market is an ongoing auction where the purpose of price is to find the area where the most volume can be transacted. The "Defense Zones" calculated by this script represent "High Volume Nodes" (HVN). Scientifically, these are levels of high price acceptance. When price moves away from these zones and returns, the script tests whether the "Value" has shifted or if the previous participants are still willing to transact at that level.
• Statistical Outlier Theory
The "Ultra High Volume" detection utilizes a non-parametric approach to identify outliers. By comparing the current volume to the rolling maximum of the previous $N$ periods, the script effectively identifies events that fall outside the standard distribution of market activity. This is mathematically equivalent to identifying "Z-score" spikes in volume, signifying a significant shift in market sentiment or the injection of institutional liquidity.
• Volume Weighted Cost Basis (VWCB)
The use of VWAP within the defense zones is based on the academic concept of the "Volume Weighted Cost Basis." In institutional finance, the execution quality of a large trade is measured against the VWAP. Therefore, these levels act as psychological and financial "anchors" for large participants who need to protect their average entry price to maintain a profitable position.
⚠️ Disclaimer
All provided scripts and indicators are strictly for educational exploration and must not be interpreted as financial advice or a recommendation to execute trades. I expressly disclaim all liability for any financial losses or damages that may result, directly or indirectly, from the reliance on or application of these tools. Market participation carries inherent risk where past performance never guarantees future returns, leaving all investment decisions and due diligence solely at your own discretion.
Script de código abierto
Fiel al espíritu de TradingView, el creador de este script lo ha convertido en código abierto, para que los traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Aunque puede utilizarlo de forma gratuita, recuerde que cualquier republicación del código está sujeta a nuestras Normas internas.
💡 Proprietary indicators. Original research. Built by analysts who trade.
👑 Premium: markittick.com
📢 Free Telegram: t.me/MarkitTick_Updates
👑 Premium: markittick.com
📢 Free Telegram: t.me/MarkitTick_Updates
Exención de responsabilidad
La información y las publicaciones no constituyen, ni deben considerarse como, asesoramiento o recomendaciones financieras, de inversión, de trading u otro tipo, proporcionadas o respaldadas por TradingView. Obtenga más información en Condiciones de uso.
Script de código abierto
Fiel al espíritu de TradingView, el creador de este script lo ha convertido en código abierto, para que los traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Aunque puede utilizarlo de forma gratuita, recuerde que cualquier republicación del código está sujeta a nuestras Normas internas.
💡 Proprietary indicators. Original research. Built by analysts who trade.
👑 Premium: markittick.com
📢 Free Telegram: t.me/MarkitTick_Updates
👑 Premium: markittick.com
📢 Free Telegram: t.me/MarkitTick_Updates
Exención de responsabilidad
La información y las publicaciones no constituyen, ni deben considerarse como, asesoramiento o recomendaciones financieras, de inversión, de trading u otro tipo, proporcionadas o respaldadas por TradingView. Obtenga más información en Condiciones de uso.