Editors' picksOPEN-SOURCE SCRIPT

Volume composition / quantifytools

Updated
— Overview

While net volume is useful information, it can be a blunt data point. Volume composition breaks down the content of volume, allowing a more detailed look inside each volume node. Volume composition consists of the following information:

Total volume (buy and sell). By default gray node.
Dominating volume (buy or sell). By default dark green/dark red node.
Dominating active volume (buy or sell). By default light green/light red node.
Dominating volume as percentage of total volume.
Dominating active volume as percentage of total active volume.

Buy and sell volume is defined by volume associated with lower timeframe up/down moves. This classification is further broken down to passive/active, standing for decreasing/increasing volume, e.g. a move up with volume higher than previous bar volume = active buy volume, a move up with volume lower than previous bar volume = passive buy volume.

snapshot

Volume data is fetched from a lower timeframe that is automatically adjusted to fit the timeframe you're using. By default, the following settings are applied:

Charts <= 30 min: 1 minute timeframe
Charts > 30 min & <= 3 hours : 5 minute timeframe
Charts > 3 hours & <= 8 hours : 15 minute timeframe
Charts > 8 hours & <= 1D: 1 hour timeframe
Charts > 1D & <= 3D : 2 hour timeframe
Charts > 3D: 4 hour timeframe

Timeframe settings can be changed via input menu. The lower the timeframe, the more precision you get but with the cost of less historical data and slower loading time. Users can also choose which source to use for determining buy/sell volume, e.g. using close as source, a close that is higher than previous close would be considered as buy volume. This could be replaced with OHLC4 for example, resulting in a volume direction based on OHLC average.

Volume composition of current chart can also be replaced with any other chart volume composition:

snapshot

— Visuals

Breakdown of visual elements:

1. Symbol and timeframe used for volume composition calculations. By default the chart that is viewed and automatically selected lower timeframe.
2. Dominating volume threshold exceeded. Can be defined via input menu, 70% of total volume by default.
3. Dominating volume as percentage of total volume. Plotted below volume nodes, without % symbol.
4. Dominating active volume, + or - symbol, standing for buy and sell. Plotted below dominating volume percentage. When dominating volume and dominating active volume sides are in a disagreement (e.g. dominating volume is on buy side while dominating active volume is on sell side) this symbol will appear inside brackets, (+) or (-).
5. Dominating active volume as percentage of total active volume. Plotted below +/- symbol.
6. Dominating active volume threshold exceeded. Can be defined via input menu, 70% by default.

snapshot

Dominating volume & active volume percentages can be rounded to single numbers to avoid clutter caused by overlapping values. The percentage values will be rounded to closest single number value, e.g. dominating volume percentage at 54% = 5, dominating volume percentage at 55% = 6.

snapshot
snapshot

Volume anomalies can be highlighted on the chart with a color for studying the events and their past implications in greater detail. Available anomalies for highlights are the following:

Buy volume threshold exceeded
Sell volume threshold exceeded
Active buy volume threshold exceeded
Active sell volume threshold exceeded
Volume & active volume divergence

snapshot

— Practical guide

Volume is arguably one of the most important data points as it directly relates to liquidity. High volume can be an indication of strength (price likely to continue moving) or absorption (price likely to halt/turn). Same applies to active volume, but with an element of aggression. High active volume serves as an indication of exuberance or otherwise forceful transacting, like stop losses triggering. With these principles in mind, the composition of volume allows distinguishing potentially important events.

Example #1: Identifying areas of trapped market participants

Often when volume spikes distinctively, we can make the case that price has found sufficient liquidity to halt/turn. Since we know which side was absorbed, in what quantity and type (passive/active), we can identify areas of trapped market participants. In such scenarios, the higher the dominant active volume and volume spike itself, the better.

snapshot

Example #2: Identifying a healthy trend

A healthy trend is one that has an active and consistent bid driving it. When this is the case, it can be seen in consistently supportive active volume.

snapshot

Example #3: Identifying inflection points

When dominant side of volume and dominant side of active volume diverge, something is up. A divergence often marks an area of indecision, hinting an imminent move one way or the other.

snapshot
Release Notes
Update

1. Clarification on technical documentation and code

2. Added alerts, available for following scenarios:

- Confirmed buy volume threshold exceeded
- Confirmed sell volume threshold exceeded
- Confirmed active buy volume threshold exceeded
- Confirmed active sell volume threshold exceeded
- Confirmed volume/active volume divergence

Alerts are available individually and grouped, e.g. alert will trigger on confirmed buy volume threshold exceeded anomaly vs. alert will trigger on any confirmed volume anomaly. All grouped alert scenarios can be viewed in the alert menu.
Release Notes
Update

1. Fixed a bug causing occasional incorrect plots for active volume direction symbols (+ or -).
2. Removed volume sum values from script status line (next to script title) which on certain symbols took a lot of visual space. Volume sums can still be easily observed using panel Y axis or data window.
3. Multiple volume anomalies can now be highlighted on chart simultaneously:

snapshot
Release Notes
Update

Highlighter can now be used for multi-condition scenarios, events where any combination of available anomalies took place simultaneously, e.g. a highlight will occur when both passive and active buy volume thresholds were exceeded at the same time. Multi-condition highlights will be visible in yellow bar color and an X symbol by default. These events can be further refined using additional price and net volume conditions.

Available price based conditions are the following:

Close higher than previous close
Close lower than previous close
Reversal up (engulfing/wick)
Reversal down (engulfing/wick)
Expansion up (volatile move with strong close up)
Expansion down (volatile move with strong close down)

Specific criteria for price based conditions can be viewed from technical documentation.

Net volume condition can be applied in the form of a multiplier based on volume relative to volume moving average. A multiplier of 1 will highlight events where net volume was equal to or greater than volume moving average, a volume multiplier of 2 will highlight events where net volume was equal to or greater than 2x volume moving average.

Multi-condition scenarios allow a much more detailed and specific studies of volume anomalies, their relation to each other and their relation to price based events:

Example #1: Sellers into reversals

snapshot

Example #2: Buyers initiating a trend

snapshot

Note that creating a scenario that is too specific will lead to overfitting issues. If your specified scenario has very little amount of matches, it likely provides no information utility. The bigger the data set, the better. Alerts for multi-condition scenarios can be set from the alert menu by choosing "Multi-condition anomaly". Desired conditions should be activated before creating an alert.
Release Notes
Updated license
Release Notes
Update

Volume can now be displayed in relative terms, i.e. volume relative to volume moving average. Values above 1 correspond to volume being above moving average, values below 1 to volume being below moving average.

Relative volume is a simple way to get a read on extremity of volume by benchmarking it against an average, e.g. relative volume at 1.5x = volume is 1.5x higher than on average.

snapshot
aggressivebuyersaggressivesellersbuysellvolumebuyvolumedeltadeltavolumesellvolumeVolume IndicatorvolumedeltavolumespikeVolume

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?


✨ Get instant access to Premium Toolstack for Free: Liquidity prints, Price based concepts and Liquidity composition

✨ Start 7-Day Free Trial: quantify.tools

Watch video tutorials covering our tools on Youtube ↓
Also on:

Disclaimer