OPEN-SOURCE SCRIPT
Telah dikemas kini

Supply & Demand Zones

8 073

_____________________________________________________________________

Supply and Demand Zones

This indicator displays valid Supply and Demand zones on any chart and timeframe, using dynamically updating visuals. Users can see the moment that zones become validated, used, and then invalidated during live sessions. It is sleek, lightweight, and offers a feature-rich settings panel that allows customization of how each element appears and functions. Zones can enhance the probability of successful trades by locating areas that are most likely to contain resting orders of Supply or Demand, which are needed for price reversals.


Disclaimer
____________________

Like all indicators, this can be a valuable tool when incorporated into a comprehensive, risk-based trading system.

  • Supply and Demand is not the same thing as Support and Resistance.
  • Trading based on price hitting a zone without understanding which zones are of higher quality and which are of lower quality (only discernible with a trained human eye) will yield poor results.
  • Supply and Demand works well as a system and even better when added to an existing one. However, like all effective trading techniques, it requires diligent study, practice, and repetition to become proficient. This is an indicator for use with Supply and Demand concepts, not a replacement for learning them.



Features
____________________

Once a valid candle sequence is confirmed, a box will appear that displays the zone over the precise zone range. At 50% zone penetration, a zone becomes used, and at 100% it becomes invalidated. Each of these zone classifications changes the behavior of the zone on the chart immediately. The settings panel offers custom colors for Supply, Demand, Used, and Invalidated zone types.

  • Borders: The subtle border colors can be changed or hidden.
  • Boxes or Bases: Advanced users can opt to hide zone boxes and instead display small, subtle tags over base candle groups. This allows for more customizable selection over what is displayed and how.
  • Max Zones and Hide Invalidated:
    • There are limitations on how many objects TradingView allows at once. Because of this, once zones go from used to invalidated, they are hidden (deleted) by default. This allows the zones index to be allocated to display more valid, usable zones instead. If a user prefers to keep invalidated zones visible, they can be enabled; however, this will result in showing more recent zones for fewer historical zones.
    • All zones share one pool, so if you allow fifty max zones, forty-five might be supply while five might be demand on a big sell-off trend. You will always see the most recent zones, regardless of type or status.
    • It’s up to you how much clutter you want on your screen and how much improved load time you want - but once loaded, zone creation and function are always instantaneous.



Load Time
____________________

  • Load time refers to the time it takes from when you switch tickers or timeframes before the zones are displayed initially. There is zero lag in the dynamic function and minimal load time, regardless of settings. However, if you are a fine-tuner or multi-screener, the number of Max Zones displayed is the only major variable affecting load time.
  • I run everything at Max when I develop. When I trade, I run mine at 25 max zones because I change timeframes often and want a very quick display of zones when I do. I have invalidated hidden, and simply enable it if I want to check an old zone. This gives me more zones than I need and reduces the load time to right where I like it.



Thresholds
____________________

It is recommended to leave these as the default.
  • Base Body Threshold: Determines the maximum ratio of a candle’s body to wick before invalidation. Default (50% or 0.5). A higher number loosens thresholds, resulting in more zones being displayed.
  • Unrequire 2nd FT if LO is Strong & Strength Multiplier:
    • The standard logic sequence requires two Follow-Through candles. Under some strong price movement, Leg-Out candles can make an explosive directional move from a base, making a convincing argument for supply and demand perfectly at work, if not for a single Follow-Through candle instead of two.
    • By enabling this feature, you can tell the script to ignore second Follow-Through candles, if and only if, the Leg-Out candle's range is (Strength) X the base range. exceeds the range of the Base by a factor of X (Strength). ie: At 5x, this would require a Leg-Out range to be 500% the range of the Base.
    • If enabled and the Leg-Out is not strong enough, the default logic kicks in, and a second follow-through candle will validate the zone as per usual. This loosens thresholds overall and should result in more zones.



Recommended Usage
____________________

  1. Form a thesis using your primary trend trading system (eg: Elliott Wave, Structure Reversal, TheStrat, et al) to identify locations of a pullback for a long or short entry.
  2. Identify a pullback area using your system, then use this indicator to find a high-quality zone on your chosen timeframe.
  3. Once located, draw your own channel over the indicator's zone box. Start on 1m, check for zones, 2m, 3m, and so on. When you see a zone you like, recreate it; thus, when finished, you can see every timeframe’s highest-quality zones that you created, regardless of what timeframe you switch to. Tip: Be selective
  4. To make the process faster, save a channel design in settings for “Demand” and one for “Supply”, then you can quickly get through this process in less than a minute with practice.
  5. Optional: Use additional methods (eg: Fibonacci retracements, Elliott Wave Theory, Anchored VWAPs) to find congruent confirmation.



Version 1.0
____________________

* No known bugs remain from the closed beta.


In Development
____________________

* Powerful combination zones occur when standard zone sequences are extended with additional levels of demand or supply by adding more conditionals to the state machine logic. Got this mostly working in a dev version and it adds minimal extra resources. Set aside to polish a clean standard 1.0 for release first, but now displaying these extended zones is my top priority for next version.
* MTF support is essentially working in a dev copy, but adds resources. Not sure if it is in the spirit of price action being the primary focus of a chart for serious traders, rather than indicators. If there is demand for it, I'll consider it.
* Additional Threshold Settings


Thanks!
____________________

Thank you for your interest in my work. This was a personal passion project of mine, and I was delighted it turned out better than I hoped, so I decided to share it. If you have any comments, bugs, or suggestions, please leave them here, or you can find me on Twitter or Discord.

@ ContrarianIRL
Open-source developer for over 25 years

Nota Keluaran
Minor logic tweak.
Nota Keluaran
Minor logic tweak.
Nota Keluaran
Added setting: "Allow FT zone penetration"

The primary rule of follow-through candles is that they make a higher high (demand) or a lower low (supply). For my own trading, I allow FT candles to wick into my zone range as long as they close outside of it and make that higher high or lower low. This is now a feature, enabled by default. But, if you prefer absolutely no penetration and stricter logic, disable this setting, and you will see less zone density.

When "Allow FT zone penetration" is enabled (default, true):
For supply zones, the FT candle's high (wick) can enter the zone (up to supply_highest_high), but it must close below the lowest body of the base candles (supply_lowest_body).

For demand zones, the FT candle's low (wick) can enter the zone (down to demand_lowest_low), but it must close above the highest body of the base candles (demand_highest_body).

When "Allow FT zone penetration" is disabled (false):
For supply zones, the FT candle's high must be ≤ supply_lowest_body (no wick penetration into the zone).

For demand zones, the FT candle's low must be ≥ demand_highest_body (no wick penetration into the zone).

syot kilat
Nota Keluaran
Minor logic tweak.
Adjusted "Allow FT Zone Penetration" to limit penetration to 50% of the zone range.
Changes
Supply Zones: Follow-through (FT) candles can penetrate up to the midpoint (50%) of the zone’s range when enabled; close must remain below the zone’s bottom.

Demand Zones: FT candles can penetrate down to the midpoint (50%) of the zone’s range when enabled; close must remain above the zone’s top.

Disabled Option (no change): No penetration allowed beyond zone boundaries when the feature is turned off.

Purpose
Enhances zone reliability by preventing weak price action from forming zones.
Aligns FT candle logic with the existing 50% "used" condition for consistency.

Penafian

Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.