Indicator · Pine Script v6 · On the chart

Volume Profile (Simulated)

by dcaoyuan

This indicator builds a simulated volume profile on the price chart.

View on GitHub

GitHub stars55on the repository
Pine versionv6current
Lines of code40
Settings0inputs
LicenceApache-2.0
Last update6 months ago20 Apr 2026

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.

Source Code

40 lines of Pine Script v6 from public/indicators/vpvr.pine, published under Apache-2.0. Keep the author's credit and licence lines when you reuse it.

vpvr.pine
//@version=6
indicator("Volume Profile (Simulated)", overlay=true, max_lines_count=500)

// Parameters
rows = 50
lookback = 200 // Number of bars to analyze

// Calculate Volume Profile
if barstate.islast
    float max_vol = 0.0
    float highest_high = high
    float lowest_low = low
    
    // Find highest high and lowest low over the lookback period
    for i = 0 to lookback - 1
        highest_high := math.max(highest_high, high[i])
        lowest_low := math.min(lowest_low, low[i])
    
    // Initialize volume array
    float[] vol_array = array.new_float(rows, 0.0)
    float price_step = (highest_high - lowest_low) / rows
    
    // Distribute volume into bins
    for i = 0 to lookback - 1
        int bin = math.floor((close[i] - lowest_low) / price_step)
        if bin >= 0 and bin < rows
            float current_vol = array.get(vol_array, bin)
            float new_vol = current_vol + volume[i]
            array.set(vol_array, bin, new_vol)
            max_vol := math.max(max_vol, new_vol)
            
    // Draw the profile
    for i = 0 to rows - 1
        float vol = array.get(vol_array, i)
        if vol > 0
            float width = (vol / max_vol) * 100 // Scale width
            // Calculate bar coordinates
            price_level = lowest_low + (i * price_step)
            // Draw horizontal line representing the volume bar
            line.new(x1=bar_index, y1=price_level, x2=bar_index - int(width), y2=price_level, color=color.new(color.blue, 50), width=4)

Overview

On the last bar it finds the highest high and lowest low across the previous 200 bars, splits that range into 50 price bins, and adds each bar's volume to the bin of its close. It draws a horizontal line at each occupied price level, with length scaled to that bin's share of the largest bin. Rows, lookback, and colors are fixed in the code, and there are no trading signals or alerts.

Details

Published by

dcaoyuan on GitHub

Type

Indicator, Pine Script v6

Draws

On the price chart

Category

Volume, Support & resistance

Markets

Any symbol

Timeframes

Any timeframe

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Topics

aicharttradingvibepinescripttechnical-analysispinestock

Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.

Similar Pine Scripts

This overlay indicator draws a fixed-range volume profile on the price chart, splitting traded activity into up and down volume at each price level. It also plots a sentiment profile, a developing point of control, and value-area high and low around a configur

Indicator v5 VolumeSupport & resistance
Updated 2 months ago · MIT GitHub repository of Volume Profile and Indicator by DGT

MGIC-tracker

by Allen1212
303 stars

The MGIC-tracker is a TradingView indicator that overlays ARK Invest trade records onto stock price charts. It plots buy and sell labels at the exact timestamp of each transaction, showing share volume and ETF weight. Users select a specific ETF type via setti

Indicator v4 Support & resistanceVolume
Updated 2 years ago · None stated GitHub repository of MGIC-tracker
218 stars

Comprehensive Volume Profile is an overlay indicator that calculates and plots volume distribution across specified time ranges such as daily sessions, weekly, monthly, or custom bar lengths. It identifies key structural price levels including the Point of Con

Indicator v6 VolumeSupport & resistance
Updated 3 months ago · None stated GitHub repository of Comprehensive Volume Profile

Moon Dev GEX Arrows

by moondevonyt
92 stars

This overlay indicator plots option strike walls and an optional session VWAP on the price chart for SPY or ES. It spaces major strikes by the selected instrument, draws a set number of strikes on each side, and marks wall-trap and sweep events after a cooldow

Indicator v5 Support & resistanceSessions & time
Updated 8 weeks ago · Custom licence GitHub repository of Moon Dev GEX Arrows

More indicators

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers