BuySell box

Based on the high-low-close structure of each candlestick and the volume distribution ratio, this indicator segments price ranges to help you understand how volume moves within a specific range.
This indicator provides the following visualizations:
Boxes indicating dominant buy and sell volume zones
Percentage labels showing volume distribution
Automatic reconfiguration of zones when a status change occurs
Direction change detection using RSI-based auxiliary values (div_t)
■ Calculation Logic
Instead of relying solely on raw volume, this indicator uses the internal structure of the candlestick (the high-close-low ratio) to distinguish between buy and sell volume.
● Calculating Volume Distribution
For each candle:
Type Formula
vol_cell (high - close) / (high - low) × volume
vol_buy (close - low) / (high - low) × volume
Cumulative average of the absolute candle body, adjusted using the average spread box_size_multiplier
This method estimates the distribution of volume using the relative positions of the candles, which serves as the basis for creating the volume boxes.
■ State Transition Detection Logic
This indicator detects changes using the div_t value (div_t = RSI × 5 - 250).
● Conditions
div_t > +50 → item_top state
div_t < −50 → item_bot state
When the state changes, the previous box closes and a new range begins.
This allows the box to accumulate and display volume movement from the moment the state transitions until the next transition.
■ Box Creation Process
When a state transition occurs, the following actions are executed:
● 1) Reset Range
Store Base Price (Low or High)
Store Time
Reset Accumulated Buy/Sell Volume
● 2) Create Box
If i_show_volpower = true, the indicator creates the following:
● Bottom Area (item_bot)
Two types of buy boxes (outer and inner)
Two types of cell boxes (outer and inner)
Volume Ratio Label
Dotted Line (low_line)
● Top Area (item_top)
Two types of buy boxes (outer and inner)
Two types of cell boxes (outer and inner)
Volume Ratio Label
Dotted Line (high_line)
■ Box Expansion Logic (Accumulation Process)
New volumes are continuously added while the state remains unchanged, and the box width (right) automatically expands.
Cumulative Volume (total_vol)
Cumulative Buy/Sell Volume
Recalculated Percentage Ratio
Box expands based on updated percentage
Labels update their text and position in real time.
This structure visually compares how buy and sell volumes accumulate across the entire range.
■ Visual Components
● Box
Buy Box (based on i_buy_color)
Sell Box (based on i_sell_color)
Neutral tone applied to border or label text
Transparency can be adjusted via i_box_transp
● Label
Displays cumulative buy/sell volume percentages
Format: "buy(x) − y%", "sell(x) − y%"
Text color adjusts based on relative dominance.
● Line
Dotted reference lines anchored to high or low values
Helps visualize the structure of each observed range.
■ Input Parameters
Parameter Description
Buy/Sell Volume %: Enables volume-based box visualization.
Past: Determines whether previous boxes remain visible.
Box Size: Controls the vertical resizing of the box.
Buy/Sell/Neutral: Defines the color scheme for the volume areas.
Box Transparency: Controls the transparency of the box background.
■ Repaint Behavior
During live candles, volume accumulation and label updates may dynamically change.
However, confirmed historical candles are not recalculated or modified.
Box and label updates reflect ongoing range development, not redrawing completed data.
Box creation or deletion occurs only during state transitions, and previous results remain unchanged.
■ Purpose
Presents the cumulative volume distribution during strong directional phases.
Visualizes relative contributions within defined ranges.
Segments market behavior to identify structural changes.
■ Notes and Limitations
This indicator does not predict market direction or provide guaranteed results.
div_t is derived from the RSI and is not intended for overbought/oversold interpretation.
The volume distribution (vol_buy / vol_sell) is simplified and may not represent the full order flow details.
Excessive number of boxes/labels may result in reaching the object limit.
Box lengths and ratio labels may continue to update on real-time candlesticks until the range closes.
Skrip hanya-undangan
Hanya pengguna yang disetujui oleh penulis yang dapat mengakses skrip ini. Anda perlu meminta dan mendapatkan izin untuk menggunakannya. Izin ini biasanya diberikan setelah pembayaran. Untuk detail selengkapnya, ikuti petunjuk penulis di bawah ini atau hubungi c9indicator secara langsung.
TradingView TIDAK menyarankan untuk membayar atau menggunakan skrip kecuali Anda sepenuhnya mempercayai pembuatnya dan memahami cara kerjanya. Anda juga dapat menemukan alternatif yang gratis dan sumber terbuka di skrip komunitas kami.
Instruksi penulis
Pernyataan Penyangkalan
Skrip hanya-undangan
Hanya pengguna yang disetujui oleh penulis yang dapat mengakses skrip ini. Anda perlu meminta dan mendapatkan izin untuk menggunakannya. Izin ini biasanya diberikan setelah pembayaran. Untuk detail selengkapnya, ikuti petunjuk penulis di bawah ini atau hubungi c9indicator secara langsung.
TradingView TIDAK menyarankan untuk membayar atau menggunakan skrip kecuali Anda sepenuhnya mempercayai pembuatnya dan memahami cara kerjanya. Anda juga dapat menemukan alternatif yang gratis dan sumber terbuka di skrip komunitas kami.