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

Skrip sumber terbuka

Dalam semangat sebenar TradingView, penulis telah menerbitkan kod Pine ini sebagai sumber terbuka supaya pedagang dapat memahami dan mengesahkannya. Sorakan kepada penulis! Anda boleh menggunakan perpustakaan ini secara percuma, tetapi penggunaan semula kod dalam penerbitan ini adalah dikawal oleh Peraturan dalaman. Anda boleh menyukainya untuk menggunakannya pada carta.

Ingin menggunakan skrip ini pada carta?

Penafian