OPEN-SOURCE SCRIPT

Cumulative Volume Distribution Spread Intrabar with Bands

Updated Description:
This script, "Cumulative Volume Spread by Levels with Histogram", analyzes cumulative buying and selling pressure at various price levels of each bar, based on intra-bar data from a lower timeframe (like 1-second bars). It visualizes the results using lines, histograms, and color-filled areas.

Key Concepts:
Price Levels: The script splits each bar into four distinct levels:

High to max(open, close): The range from the highest price of the bar to the higher of the open or close prices.
Max(open, close) to midline: The range from the higher of the open or close to the midpoint of the bar.
Midline to min(open, close): The range from the midpoint to the lower of the open or close.
Min(open, close) to low: The range from the lower of the open or close to the lowest price of the bar.
Volume Pressures:

The script fetches volume data from a lower timeframe (default is 1-second bars) to capture intra-bar buying and selling pressure.
Buying Pressure: Calculated when the close is greater than the open.
Selling Pressure: Calculated when the close is less than the open.
Cumulative Pressures:

The script accumulates buy and sell volumes within each of the four price levels described above.
At the beginning of a new day, these cumulative values are reset.
Spread Calculation:

For each level, the script calculates the spread between cumulative buying and selling volumes (i.e., buy pressure minus sell pressure). A positive spread indicates more buying pressure, and a negative spread indicates more selling pressure.



The script calculates an Exponential Moving Average (EMA) of the spread changes for each section:
EMA Spread High to Max Open/Close
EMA Spread Max Open/Close to Midline
EMA Spread Midline to Min Open/Close
EMA Spread Min Open/Close to Low
Fill Between Levels:

The areas between the key price levels are filled based on whether the EMA of the spread is positive (green) or negative (red). This helps to visually indicate where buying or selling pressure is stronger.
Background Color:

The script determines an overall background color based on the relative strength of cumulative buying vs. selling pressure. If cumulative buying pressure is stronger across the levels, the background turns green; if selling pressure dominates, it turns red.
Cycles

开源脚本

本着真正的TradingView精神,此脚本的作者已将其开源,以便交易者可以理解和验证它。向作者致敬!您可以免费使用它,但在出版物中重复使用此代码受网站规则约束。 您可以收藏它以在图表上使用。

想在图表上使用此脚本?

免责声明