OPEN-SOURCE SCRIPT

Volume Supply and Demand [TradingIQ]

13 377
The Next Generation of Supply and Demand

You haven't seen a single good Supply and Demand indicator until today.

Let's be honest: almost every S/D indicator you've tried is either too late, constantly repaints, or simply flags every single random pivot on the chart as a "zone." That is not how institutional trading works. Traditional support and resistance might teach you to draw lines at every turning point, but if you've been trading for more than two weeks, you know that not every pivot holds weight in the future.

This tool was built to fix that. It is designed to filter out the low-quality noise, bypass the common structural flaws of basic chart metrics, and isolate nothing but genuine liquidity shock events where massive market orders actually took place.

Welcome to the Volume Supply and Demand engine.

---

How the Algorithm Works (The "Why")

Easier said than done, right? Finding a level that actually has institutional defense behind it requires deep mathematical screening. Instead of just looking for simple highs and lows, this algorithm detects explosive price moves via an advanced multi-step screening system.

First, the script calculates the True Range of consecutive candles to establish a baseline of normal market volatility. Once that baseline is set, it actively scans for sudden, abnormal expansions in price. It analyzes the specific angle, slope, and velocity of the expansion to ensure the move is statistically anomalous.
  • Demand Zones: These are flagged when extreme buying pressure forces a rapid, high-velocity move upwards, leaving behind a massive footprint of unfilled passive limit orders.
  • Supply Zones: These are flagged when intense selling aggression ramps up instantly, completely rejecting higher prices and driving the market down with severe negative velocity.

We strictly filter out the low-quality, minor pivot points. Once the strict qualifications of velocity and range expansion are met, the zone is detected and locked in instantly.
---
Structure vs. Normal Support & Resistance

To trade effectively, you must understand why these zones behave differently than standard horizontal support and resistance lines.

Traditional support and resistance lines can theoretically be drawn anywhere the market decides to turn around, regardless of the volume or speed behind the move. This creates messy charts cluttered with hundreds of psychological lines that offer no real edge.

This engine is different because it maps out an entire premium or discount zone based on the exact candle structural properties where the initial institutional imbalance occurred. It targets the literal origin of the reaction, creating a highly precise boundary where a major market participant stepped in aggressively to flip the auction control.

---

Deep-Dive Order Flow Features

We didn't just build a box-drawing tool. We added an entirely new dimension of volume analysis to help you gauge the actual internal strength of these levels.

  • Origin Volume Profiles: This is the game-changer. For every valid Supply or Demand zone generated, the indicator dynamically projects a micro Volume Profile directly inside the specific structural move that created the zone. You get an immediate, visually clear picture of exactly where the heavy volume was transacted during that specific liquidity event.
  • Delta & POC Lines: The algorithm identifies the Point of Control (POC) for both the buy-volume side and the sell-volume side independently. By plotting these lines, you can see precisely where the buyers or sellers exhibited their maximum aggression right before the major expansion occurred.
  • Time-Based Profiles: Volume isn't the only metric that matters. You can change the profile type inside the settings to "Time" to generate a profile that maps out exactly where the price spent the most time consolidating before exploding out of the zone.
  • Auto Hit-Deletion: The more a level is traded into, the weaker it gets as the resting passive orders are continuously matched and filled. To prevent you from trading dead levels, the indicator includes an automated hit-deletion toggle. The moment the price decisively pierces through a zone, the script recognizes the liquidity exhaustion and wipes the zone from your chart.


---

Settings & Optimization Guidelines

Because this script relies on heavy historical array calculations and complex request structures, proper optimization is essential for a smooth charting experience:

  • S/D Zone Style (Wick, Body, Candle): This dictates the strictness of your zone boundaries.
    • Wick (Default & Strongly Recommended): Draws the zone across the precise wick of the origin candle, capturing the maximum premium/discount extremity.
    • Body / Candle: Alternative constraints that alter the vertical width of the boxes based on the candle open and close values.
  • Max Zone Age (Bars): A zone created hundreds of bars ago losing its relevance because the participants holding those orders have likely closed their positions. This setting expires old zones to keep your chart fresh. If your chart experiences loading delays, lower this setting to roughly 200 bars.
  • Calculated Bars: To manage the calculation weight of the Epanechnikov kernel filtering and volume slice matrices, you can adjust the total calculation window. If your chart shows a red runtime error, lower this setting from 5000 down to 2000 bars.
  • Show Volume at Level: Turning this on overlays the raw numerical transaction data over each individual profile block, allowing for precise order flow calculation.

---
The Core Trading Logic

When a zone is formed by a massive imbalance of aggressive market orders, institutional participants frequently leave resting passive limit orders behind because the market moved too quickly to fill their entire block. When price returns to this exact zone for the first time, those resting orders are triggered. This acts as a defense line, forcing an aggressive, fast reversal.

If price returns to a zone multiple times, or if it begins to grind and spend a long time consolidating inside a box, that is a major warning sign. It means liquidity is actively depleting, the passive orders are being entirely consumed, and a massive liquidity shock breakout is right around the corner.

Disclaimer: This is not financial advice. Always test the mechanics against your own personal edge, backtest thoroughly, and integrate it properly within your broader risk management plan.

Wyłączenie odpowiedzialności

Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.