OPEN-SOURCE SCRIPT
Cumulative Buy/Sell Volume[MIT]

Cumulative Buy/Sell Volume - Stacked/Separate Mode
Description:
This indicator calculates and displays the cumulative buy and sell volume over the past N bars (lookback period). It splits volume based on price movement:
Up bars (close > open) → All volume assigned to Buy
Down bars (close < open) → All volume assigned to Sell
Flat bars (close == open) → Configurable handling (split 50/50, ignore, all to buy, or all to sell)
Key Features:
Two display modes:
Fully customizable colors for Buy and Sell bars (with high transparency for better stacking visibility)
Rolling window calculation (default 20 bars)
Optional debug label on the last bar showing exact Buy/Sell cumulative values
Inputs:
Lookback Period n: Number of bars to look back for cumulative volume (default: 20)
Flat Bar Volume Handling: How to handle doji/flat bars (Split 50/50, Ignore, All to Buy, All to Sell)
Display Mode: Separate Display or Stacked Display
Show Buy Volume / Show Sell Volume: Toggle visibility
Buy Bar Color / Sell Bar Color: Custom color picker
Usage Tips:
Use "Stacked Display" to quickly see which side (buy or sell) dominates the recent volume.
Use "Separate Display" for clear absolute strength comparison.
Higher transparency ensures overlapping bars in stacked mode remain distinguishable.
Best used on active stocks with sufficient volume.
Note: This is a non-overlay indicator (shows in a separate pane). Combine with price chart for better context.
指标名称: 累计买/卖成交量 - 叠加/分开模式
短标题: Cum BuySell Vol Custom
指标描述:
本指标计算并显示过去 N 根 K 线的累计买入量和卖出量。根据价格走势对成交量进行拆分:
主要功能:
两种显示模式:
参数说明:
使用建议:
叠加模式适合快速判断近期成交量中买方或卖方更强势(柱子谁高谁占优)。
分开模式适合清晰对比买/卖绝对力量差异。
高透明度设置确保叠加时两种颜色都能透出,不会完全覆盖。
建议用在成交活跃的个股上,效果更明显。
Description:
This indicator calculates and displays the cumulative buy and sell volume over the past N bars (lookback period). It splits volume based on price movement:
Up bars (close > open) → All volume assigned to Buy
Down bars (close < open) → All volume assigned to Sell
Flat bars (close == open) → Configurable handling (split 50/50, ignore, all to buy, or all to sell)
Key Features:
Two display modes:
- Separate Display: Buy bars upward (green), Sell bars downward (red) — classic side-by-side comparison
- Stacked Display: Both bars upward — visually stacked to show total volume and buy/sell dominance
Fully customizable colors for Buy and Sell bars (with high transparency for better stacking visibility)
Rolling window calculation (default 20 bars)
Optional debug label on the last bar showing exact Buy/Sell cumulative values
Inputs:
Lookback Period n: Number of bars to look back for cumulative volume (default: 20)
Flat Bar Volume Handling: How to handle doji/flat bars (Split 50/50, Ignore, All to Buy, All to Sell)
Display Mode: Separate Display or Stacked Display
Show Buy Volume / Show Sell Volume: Toggle visibility
Buy Bar Color / Sell Bar Color: Custom color picker
Usage Tips:
Use "Stacked Display" to quickly see which side (buy or sell) dominates the recent volume.
Use "Separate Display" for clear absolute strength comparison.
Higher transparency ensures overlapping bars in stacked mode remain distinguishable.
Best used on active stocks with sufficient volume.
Note: This is a non-overlay indicator (shows in a separate pane). Combine with price chart for better context.
指标名称: 累计买/卖成交量 - 叠加/分开模式
短标题: Cum BuySell Vol Custom
指标描述:
本指标计算并显示过去 N 根 K 线的累计买入量和卖出量。根据价格走势对成交量进行拆分:
- 阳线(收盘 > 开盘)→ 全部成交量计入买入
- 阴线(收盘 < 开盘)→ 全部成交量计入卖出
- 平盘(收盘 = 开盘)→ 可配置处理方式(50/50 平分、忽略、全部计买入、全部计卖出)
主要功能:
两种显示模式:
- 分开展示(Separate Display):买入柱向上(绿色),卖出柱向下(红色)——经典对比模式
- 叠加展示(Stacked Display):买入和卖出柱都向上绘制——视觉上堆叠,快速看出买/卖谁占主导
- 支持自定义买入柱和卖出柱颜色(内置高透明度,确保叠加时两种颜色都能看清)
- 滚动窗口计算(默认 20 根 K 线)
- 可选在最后一根 K 线上显示调试标签(显示精确的累计买入/卖出数值)
参数说明:
- 回看周期 n:累计计算的 K 线根数(默认 20)
- 平盘处理方式:如何处理收盘=开盘的 K 线(50/50 平分、忽略、全部计买入、全部计卖出)
- 显示模式:分开展示 或 叠加展示
- 显示买入量 / 显示卖出量:开关控制是否显示对应柱子
- Buy Bar Color / Sell Bar Color:自定义柱子颜色(支持透明度调整)
使用建议:
叠加模式适合快速判断近期成交量中买方或卖方更强势(柱子谁高谁占优)。
分开模式适合清晰对比买/卖绝对力量差异。
高透明度设置确保叠加时两种颜色都能透出,不会完全覆盖。
建议用在成交活跃的个股上,效果更明显。
Script open-source
Nello spirito di TradingView, l'autore di questo script lo ha reso open source, in modo che i trader possano esaminarne e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricordiamo che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni e le pubblicazioni non sono intese come, e non costituiscono, consulenza o raccomandazioni finanziarie, di investimento, di trading o di altro tipo fornite o approvate da TradingView. Per ulteriori informazioni, consultare i Termini di utilizzo.
Script open-source
Nello spirito di TradingView, l'autore di questo script lo ha reso open source, in modo che i trader possano esaminarne e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricordiamo che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni e le pubblicazioni non sono intese come, e non costituiscono, consulenza o raccomandazioni finanziarie, di investimento, di trading o di altro tipo fornite o approvate da TradingView. Per ulteriori informazioni, consultare i Termini di utilizzo.