The Volume by Price indicator is a powerful tool that reveals the relationship between trading volume and price levels. Unlike traditional volume indicators that show volume over time, Volume by Price displays how much volume occurred at each price level. This unique perspective helps traders identify key support and resistance zones, spot accumulation and distribution, and anticipate potential breakout points. In this comprehensive guide, you'll learn everything about the Volume by Price indicator, from its mathematical foundation to advanced trading strategies and real-world coding implementations.
1. Hook & Introduction
Imagine you’re watching a stock hover at a critical price. Suddenly, it surges upward, leaving most traders behind. What if you could spot these pressure points before the move? That’s where the Volume by Price indicator comes in. By mapping volume to price levels, this indicator uncovers hidden battlegrounds between buyers and sellers. In this article, you’ll master how to use Volume by Price to anticipate big moves, avoid false breakouts, and gain an edge in any market.
2. What is Volume by Price?
The Volume by Price (VbP) indicator is a horizontal histogram plotted alongside a price chart. Each bar represents the total volume traded within a specific price range (or bin). Unlike standard volume bars, which show volume per time period, VbP shows where the most trading activity occurred by price. This helps traders see where large players are accumulating or distributing positions. The indicator is available on most modern charting platforms and is especially popular among swing and position traders.
- Key insight: High-volume price levels often act as strong support or resistance.
- Origin: The concept was popularized by Joseph Granville’s On Balance Volume (OBV), but VbP as a chart overlay is a modern innovation.
3. Mathematical Formula & Calculation
The core idea is simple: for each price bin, sum the volume of all bars where the price traded within that bin. Here’s the step-by-step process:
- Define the number of price bins (granularity).
- Determine the minimum and maximum price in the lookback period.
- Calculate bin size:
bin_size = (max_price - min_price) / bins - For each bar, assign its volume to the appropriate price bin.
- Plot the total volume for each bin as a horizontal bar.
Worked Example:
Price bins: $100-$102, $102-$104, $104-$106
Bar 1: Price = $101, Volume = 500 (goes to $100-$102)
Bar 2: Price = $103, Volume = 300 (goes to $102-$104)
Bar 3: Price = $105, Volume = 200 (goes to $104-$106)
Result:
$100-$102: 500
$102-$104: 300
$104-$106: 200
Each price bin aggregates the volume for that range, revealing where the most trading occurred.
4. How Does Volume by Price Work?
Volume by Price works by mapping volume to price, not time. This approach highlights price levels where significant trading activity took place. The indicator uses three main inputs:
- Price data: Typically the closing price, but can use high/low or average.
- Volume data: Number of shares/contracts traded.
- Number of bins: Determines the granularity of the analysis.
By visualizing volume at price, traders can quickly spot accumulation (buyers stepping in) or distribution (sellers unloading) zones. These zones often precede major price moves.
5. Why is Volume by Price Important?
- Identifies support and resistance: High-volume price levels act as magnets for price, often halting or reversing moves.
- Filters false breakouts: Moves away from low-volume areas are more likely to be genuine, as there’s less opposition.
- Reveals market structure: Shows where big players are active, helping traders align with institutional flows.
- Limitations: Not predictive on its own; can lag in fast markets or give false signals in thinly traded assets.
6. Interpretation & Trading Signals
Interpreting Volume by Price requires context. Here’s how traders use it:
- Bullish signal: Price breaks above a high-volume area, indicating buyers have absorbed selling pressure.
- Bearish signal: Price falls below a high-volume area, showing sellers are in control.
- Neutral: Price consolidates within a high-volume zone, often leading to range-bound trading.
Common mistakes: Using VbP in isolation, ignoring market context, or misreading low-volume breakouts as strong signals.
7. Combining Volume by Price with Other Indicators
Volume by Price is most powerful when combined with other technical tools:
- RSI: Confirms momentum behind a breakout.
- Moving Averages: Identifies trend direction.
- VWAP: Highlights institutional price levels.
Example confluence strategy: Only trade breakouts above a high-volume area if RSI is above 50 and price is above the 20-period moving average.
8. Real-World Coding Examples
Let’s see how to implement Volume by Price in various programming languages and trading platforms. Use the tabs to switch between C++, Python, Node.js, Pine Script, and MetaTrader 5.
// C++: Calculate Volume by Price
#include <vector>
#include <algorithm>
struct Bar { double price; double volume; };
std::vector volumeByPrice(const std::vector& bars, int bins) {
double minPrice = bars[0].price, maxPrice = bars[0].price;
for (const auto& bar : bars) {
minPrice = std::min(minPrice, bar.price);
maxPrice = std::max(maxPrice, bar.price);
}
double binSize = (maxPrice - minPrice) / bins;
std::vector volumeBins(bins, 0.0);
for (const auto& bar : bars) {
int idx = std::min(static_cast((bar.price - minPrice) / binSize), bins - 1);
volumeBins[idx] += bar.volume;
}
return volumeBins;
} # Python: Calculate Volume by Price
class Bar:
def __init__(self, price, volume):
self.price = price
self.volume = volume
def volume_by_price(bars, bins=10):
min_price = min(bar.price for bar in bars)
max_price = max(bar.price for bar in bars)
bin_size = (max_price - min_price) / bins
volume_bins = [0] * bins
for bar in bars:
idx = int((bar.price - min_price) / bin_size)
idx = min(idx, bins - 1)
volume_bins[idx] += bar.volume
return volume_bins// Node.js: Calculate Volume by Price
function volumeByPrice(bars, bins = 10) {
const prices = bars.map(b => b.price);
const minPrice = Math.min(...prices);
const maxPrice = Math.max(...prices);
const binSize = (maxPrice - minPrice) / bins;
const volumeBins = Array(bins).fill(0);
bars.forEach(bar => {
let idx = Math.floor((bar.price - minPrice) / binSize);
idx = Math.min(idx, bins - 1);
volumeBins[idx] += bar.volume;
});
return volumeBins;
}//@version=5
indicator("Volume by Price Zones", overlay=true)
bins = input.int(10, "Number of Price Bins")
var float[] price_bins = array.new_float(bins, na)
var float[] volume_bins = array.new_float(bins, 0)
min_price = ta.lowest(low, 100)
max_price = ta.highest(high, 100)
range = max_price - min_price
bin_size = range / bins
for i = 0 to bins - 1
array.set(price_bins, i, min_price + bin_size * i)
for i = 0 to bins - 1
if close >= array.get(price_bins, i) and close < array.get(price_bins, i) + bin_size
array.set(volume_bins, i, array.get(volume_bins, i) + volume)
for i = 0 to bins - 1
var color c = color.new(color.blue, 80)
y = array.get(price_bins, i)
v = array.get(volume_bins, i)
if not na(v)
line.new(bar_index, y, bar_index + 1, y, width = math.round(v/1000), color = c)// MetaTrader 5: Calculate Volume by Price
input int bins = 10;
double price_bins[];
double volume_bins[];
void OnCalculate(const int rates_total, const double &close[], const double &volume[])
{
ArrayResize(price_bins, bins);
ArrayResize(volume_bins, bins);
double min_price = close[ArrayMinimum(close, 0, rates_total)];
double max_price = close[ArrayMaximum(close, 0, rates_total)];
double bin_size = (max_price - min_price) / bins;
for (int i = 0; i < bins; i++) {
price_bins[i] = min_price + bin_size * i;
volume_bins[i] = 0;
}
for (int i = 0; i < rates_total; i++) {
int idx = MathMin(int((close[i] - min_price) / bin_size), bins - 1);
volume_bins[idx] += volume[i];
}
}9. Customization & Alerts
Volume by Price can be tailored to fit different trading styles:
- Adjust bin size: More bins for finer detail, fewer bins for broader zones.
- Alert conditions: Set alerts for breakouts above/below high-volume areas.
- Combine with other logic: Integrate with moving averages, RSI, or custom signals.
Pine Script customization example:
// Add alert for breakout above high-volume area
alertcondition(close > array.max(volume_bins), title="Breakout Alert", message="Price broke above high-volume zone!")
10. Real-World Trading Scenarios
Let’s walk through practical scenarios where Volume by Price makes a difference:
- Breakout trading: Wait for price to clear a high-volume resistance zone before entering long.
- Range trading: Buy near the bottom of a high-volume support zone, sell near the top.
- Trend confirmation: Use VbP to confirm that a new trend is supported by strong volume at key price levels.
For example, if a stock is consolidating between $50 and $55 with most volume at $52, a breakout above $55 with rising volume suggests a strong move is likely.
11. Backtesting & Performance
Backtesting is essential to validate any trading strategy. Here’s how you can backtest a Volume by Price breakout strategy in Python:
# Python backtest example
import pandas as pd
bars = pd.DataFrame({'price': [101, 103, 105, 102, 104], 'volume': [500, 300, 200, 400, 350]})
def volume_by_price(bars, bins=3):
min_price = bars['price'].min()
max_price = bars['price'].max()
bin_size = (max_price - min_price) / bins
volume_bins = [0] * bins
for i, row in bars.iterrows():
idx = int((row['price'] - min_price) / bin_size)
idx = min(idx, bins - 1)
volume_bins[idx] += row['volume']
return volume_bins
vbp = volume_by_price(bars)
print(vbp)
Sample results: In trending markets, VbP breakout strategies can achieve win rates of 55-65% with risk/reward ratios above 1.5:1. In sideways markets, performance drops as false breakouts increase. Always combine with other filters for best results.
12. Advanced Variations
Advanced traders and institutions often tweak the Volume by Price indicator:
- Dynamic bin sizing: Adjust bin size based on volatility or ATR.
- Order flow integration: Combine with footprint charts to see real-time buying/selling pressure.
- Institutional use: Identify iceberg orders and hidden liquidity at key price levels.
- Use cases: Scalping (short-term), swing trading (multi-day), and options (spotting gamma levels).
Example: A swing trader might use wider bins to spot major accumulation zones, while a scalper uses narrow bins for intraday reversals.
13. Common Pitfalls & Myths
- Myth: All high-volume levels are support/resistance. Reality: Context matters; combine with trend analysis.
- Pitfall: Overfitting bin size to past data, leading to curve fitting.
- Signal lag: VbP can lag in fast-moving or illiquid markets.
- Over-reliance: Never use VbP alone; always confirm with other indicators and price action.
14. Conclusion & Summary
The Volume by Price indicator is a versatile tool for uncovering hidden support and resistance, spotting accumulation/distribution, and anticipating big moves. Its strength lies in visualizing where the most trading activity occurred by price, not time. For best results, combine VbP with momentum indicators, moving averages, and price action analysis. Avoid common pitfalls like overfitting and over-reliance. Whether you’re a scalper, swing trader, or investor, mastering Volume by Price can give you a decisive edge in any market. For further study, explore related indicators like VWAP and OBV to build a robust trading toolkit.
TheWallStreetBulls