Supply and Demand Visible Range [LuxAlgo]

The Supply and Demand Visible Range indicator displays areas & levels on the user's chart for the visible range using a novel volume-based method. The script also makes use of intra-bar data to create precise Supply & Demand zones.


  • Threshold %: Percentage of the total visible range volume used as a threshold to set supply/demand areas. Higher values return wider areas.
  • Resolution: Determines the number of bins used to find each area. Higher values will return more precise results.
  • Intra-bar TF: Timeframe used to obtain intra-bar data.


The supply/demand areas and levels displayed by the script are aimed at providing potential supports/resistances for users. The script's behavior makes it recalculate each time the visible chart interval/range changes, as such this script is more suited as a descriptive tool.

Price reaching a supply (upper) area that might have been tested a few times might be indicative of a potential reversal down, while price reaching a demand (lower) area that might have been tested a few times could be indicative of a potential reversal up.

The width of each area can also indicate which areas are more liquid, with thinner areas indicating more significant liquidity.

The user can control the width of each area using the Threshold % setting, with a higher setting returning wider areas. The precision setting can also return wider supply/demand areas if very low values are used and has the benefit of improving the script execution time at the cost of precision.

The Supply and Demand Zones indicator returns various levels. The solid-colored levels display the average of each area, while dashed colored lines display the weighted averages of each area. These weighted averages can highlight more liquid price levels within the supply/demand areas.

Central solid/dashed lines display the average between the areas' averages and weighted averages.


Each supply/demand area is constructed from volume data. The calculation is done as follows:

  • The accumulated volume within the chart visible range is calculated.
  • The chart visible range is divided into N bins of equal width (where N is the resolution setting)
  • Calculation start from the highest visible range price value for the supply area, and lowest value for the demand area.
  • The volume within each bin after the starting calculation level is accumulated, once this accumulated volume is equal or exceed the threshold value (p % of the total visible range volume) the area is set.

Each bin volume accumulation within an area is displayed on the left, this can help indicate how fast volume accumulates within an area.


The script execution time is dependent on all of the script's settings, using more demanding settings might return errors so make sure to be aware of the potential scenarios that might make the script exceed the allowed execution time:

  • Having a chart's visible range including a high number of bars.
  • Using a high number of bins (high resolution value) will increase computation time, this can be worsened by using a high threshold %.
  • Using very low intra-bar timeframe can drastically increase computation time but can also simply throw an error if the chart timeframe is high.

Users facing issues can lower the resolution value or use the chart timeframe for intra-bar data.

Get access to our exclusive tools:

Join our 150k+ community:

All content provided by LuxAlgo is for informational & educational purposes only. Past performance does not guarantee future results.

ด้วยจิตวิญญาณของ TradingView อย่างแท้จริง ผู้เขียนสคริปต์นี้ได้เผยแพร่เป็นโอเพนซอร์ส เพื่อให้ผู้ค้าสามารถเข้าใจและตรวจสอบได้ ไชโยให้กับผู้เขียน! คุณสามารถใช้ได้ฟรี แต่การใช้รหัสนี้ซ้ำในสิ่งพิมพ์อยู่ภายใต้กฎของบ้าน คุณสามารถตั้งเป็นรายการโปรดเพื่อใช้บนชาร์ตได้


ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมที่ เงื่อนไขการใช้บริการ