Indicator · Pine Script v5 · On the chart

Woverine - Volume Profile

by RyKaj

This indicator plots a volume profile directly on the price chart.

View on GitHub

GitHub stars1on the repository
Pine versionv5runs as is
Lines of code158
Settings9inputs
LicenceMIT
Last update3 years ago11 Oct 2023

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

158 lines of Pine Script v5 from Volumn Profile.pinescript, published under MIT. Keep the author's credit and licence lines when you reuse it.

Volumn Profile.pinescript
//@version=5
//=============================================================================================  
//  Creator: Woverine
//    
//    Source Code: https://github.com/RyKaj/PineScript/tree/main
//
//    Purpose: 
//         Woverine - Volume Profile
//
//=============================================================================================  

indicator(title='Woverine - Volume Profile', shorttitle='VP', overlay=true, precision=4, linktoseries=true, max_bars_back=1000, max_lines_count=500)


//-------------------------------------------------------------------------------------------------------------------------
// Plot colors
// https://chir.ag/projects/name-that-color/#6195ED
// https://kodify.net/tradingview/colours/basic-colours/
//-------------------------------------------------------------------------------------------------------------------------
// color colorAquaIsland = #B2DFDB
// color colorAzureRadiance = #0094ff
// color colorBlack = #363A45
// color colorBlazeOrange = #ff6a00
// color colorBlue = #2196F3
// color colorBlueChill = #088A8D
// color colorBlushPink = #fd7fe6
// color colorBurntSienna = #EF5350
// color colorCandelLight = #FCD917
// color colorCoral = #FF7F50
// color colorCyan = #17FFFF
// color colorDeathCross = #e32636
// color colorFreshEggplant = #800080
// color colorFruitSalad = #4CAF50
// color colorGoldenCross = #61ed77
color colorGray = #787B86
// color colorJapaneseLaurel = #008000
// color colorGreen = #4CAF50
// color colorJungleGreen = #39ff14
// color colorKeyLimePie = #BCBB26
// color colorLilacBush = #9575cd
// color colorLime = #00E676
color colorOrange = #FF9800
// color colorParsley = #0E4813
// color colorPastelPink = #FFCDD2
// color colorPurple = #9C27B0
// color colorRed = #FF5252
// color colorRobinEggBlue = #00C9C9
// color colorRoseBudCherry = #880e4f
// color colorRusticRed = #4E0404
// color colorSaratoga = #505010
// color colorSpringGreen = #00E676
// color colorStarship = #F2F131
// color colorTamarillo = #991515
// color colorTeal = #00897B
// color colorTealBlue = #055355
// color colorTrendyGreen = #86851b
// color colorWhite = #FFFFFF




//-------------------------------------------------------------------------------------------------------------------------
// INPUTS
//-------------------------------------------------------------------------------------------------------------------------
int iLoopBack = input.int( defval=200, title='Volume Lookback Depth [10-1000]', minval=10, maxval=1000 )
int iMaxBars = input.int( defval=500, title='Number of Bars [10-500]', minval=10, maxval=500 )
int iBarMultiLength = input.int( defval=50, title='Bar Length Multiplier [10-100]', minval=10, maxval=100 )
int iBarOffset = input.int( defval=30, title='Bar Horizontal Offset [0-100]', minval=0, maxval=100 )
int iBarWidth = input.int( defval=2, title='Bar Width [1-20]', minval=1, maxval=20 )
string sDeltaType = input.string( defval='Both', title='Delta Type', options=['Both', 'Bullish', 'Bearish'] )
bool bShowPointofControlBar = input( defval=true, title='Show Point Of Control Line' )
color colorPointofControl = input( defval=color.new( colorGray , 60), title='Bar Color' )
color colorPointofControlBar = input( defval=color.new( colorOrange, 10), title='Point of Control Color' )


//-------------------------------------------------------------------------------------------------------------------------
// VARIABLES
//-------------------------------------------------------------------------------------------------------------------------
float vp_Vmax = 0.0
int vp_VmaxId = 0
int vp_N_BARS = iMaxBars

var int vp_first = time

float[] vp_a_P = array.new_float( vp_N_BARS + 1, 0.0 )
float[] vp_a_V = array.new_float( vp_N_BARS, 0.0 )
float[] vp_a_D = array.new_float( vp_N_BARS, 0.0 )
int[] vp_a_W = array.new_int( vp_N_BARS, 0 )


//-------------------------------------------------------------------------------------------------------------------------
// Functions
//-------------------------------------------------------------------------------------------------------------------------
// configBar() =>
//     x1 = vp_VmaxId == n and bShowPointofControlBar ? math.max(time[iLoopBack], vp_first) : timenow + math.round(vp_change * (iBarOffset - array.get(vp_a_W, n)))
//     ys = array.get(vp_a_P, n)
//     line.new(x1=x1, y1=ys, x2=vp_x_loc, y2=ys, xloc=xloc.bar_time, extend=extend.none, color=vp_VmaxId == n ? colorPointofControlBar : colorPointofControl, style=line.style_solid, width=iBarWidth)

//     x1 = vp_VmaxId == n and bShowPointofControlBar ? math.max(time[iLoopBack], vp_first) : timenow + math.round(vp_change * (iBarOffset - array.get(vp_a_W, n)))
//     ys = array.get(vp_a_P, n)
//     line.new(x1=x1, y1=ys, x2=vp_x_loc, y2=ys, xloc=xloc.bar_time, extend=extend.none, color=vp_VmaxId == n ? colorPointofControlBar : colorPointofControl, style=line.style_solid, width=iBarWidth)


//-------------------------------------------------------------------------------------------------------------------------
// CALCULATIONS
//-------------------------------------------------------------------------------------------------------------------------
float vp_HH = ta.highest( high, iLoopBack )
float vp_LL = ta.lowest( low, iLoopBack )

if barstate.islast
    float vp_HL = ( vp_HH - vp_LL ) / vp_N_BARS

    for j = 1 to vp_N_BARS + 1 by 1
        array.set( vp_a_P, j - 1, vp_LL + vp_HL * j )

    for i = 0 to iLoopBack - 1 by 1
        int Dc = 0
        array.fill( vp_a_D, 0.0 )

        for j = 0 to vp_N_BARS - 1 by 1
            float Pj = array.get( vp_a_P, j )
            if low[i] < Pj and high[i] > Pj and ( sDeltaType == 'Bullish' ? close[i] >= open[i] : sDeltaType == 'Bearish' ? close[i] <= open[i] : true )
                float Dj = array.get( vp_a_D, j )
                float dDj = Dj + nz( volume[i] )
                array.set( vp_a_D, j, dDj )
                Dc += 1
                Dc

        for j = 0 to vp_N_BARS - 1 by 1
            float Vj = array.get( vp_a_V, j )
            float Dj = array.get( vp_a_D, j )
            float dVj = Vj + ( Dc > 0 ? Dj / Dc : 0.0 )
            array.set( vp_a_V, j, dVj )

    vp_Vmax := array.max( vp_a_V )
    vp_VmaxId := array.indexof( vp_a_V, vp_Vmax )

    for j = 0 to vp_N_BARS - 1 by 1
        float Vj = array.get( vp_a_V, j )
        int Aj = math.round( iBarMultiLength * Vj / vp_Vmax )
        array.set( vp_a_W, j, Aj )

//-------------------------------------------------------------------------------------------------------------------------
// PLOTING
//-------------------------------------------------------------------------------------------------------------------------
if barstate.isfirst
    vp_first := time
    vp_first

vp_change = ta.change( time )
vp_x_loc = timenow + math.round( vp_change * iBarOffset )


if barstate.islast
    for i = 0 to vp_N_BARS - 1 by 1
        x1 = vp_VmaxId == i and bShowPointofControlBar ? math.max( time[ iLoopBack ], vp_first ) : timenow + math.round( vp_change * ( iBarOffset - array.get( vp_a_W,  i) ) )
        ys = array.get( vp_a_P, i )
        line.new( x1=x1, y1=ys, x2=vp_x_loc, y2=ys, xloc=xloc.bar_time, extend=extend.none, color=vp_VmaxId == i ? colorPointofControlBar : colorPointofControl, style=line.style_solid, width=iBarWidth )

Overview

Woverine - Volume Profile calculates cumulative volume over a configurable lookback depth and displays it as horizontal bars. A point of control line marks the highest volume level and can be shown or hidden. Bullish and bearish deltas are calculated and colored according to the selected type. Bar width, length multiplier, horizontal offset, and custom colors allow adjustment of appearance. The script draws all elements on the main chart panel without repainting.

Details

Published by

RyKaj on GitHub

Draws

On the price chart

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.

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
Volume Lookback Depth [10-1000]int200iLoopBack
Number of Bars [10-500]int500iMaxBars
Bar Length Multiplier [10-100]int50iBarMultiLength
Bar Horizontal Offset [0-100]int30iBarOffset
Bar Width [1-20]int2iBarWidth
Delta TypestringBothsDeltaType
Show Point Of Control LinebooltruebShowPointofControlBar
Bar Colorcolorcolor.new( colorGray , 60)colorPointofControl
Point of Control Colorcolorcolor.new( colorOrange, 10)colorPointofControlBar
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
228 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 2 months ago · Custom licence GitHub repository of Moon Dev GEX Arrows

More Volume scripts

Related on ForexR

Trade Your Charts With a Regulated Broker

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

Compare brokers