Indicator · Pine Script v5 · On the chart

VSA Volume Spread Analysis

by Mihir-Cap

This indicator visualizes Wyckoff Volume Spread Analysis principles directly on the price chart.

View on GitHub

GitHub stars1on the repository
Pine versionv5runs as is
Lines of code69
Settings3inputs
LicenceMIT
Last update1 year ago21 May 2025

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

69 lines of Pine Script v5 from VSA_Advanced_Indicator.pine, published under MIT. Keep the author's credit and licence lines when you reuse it.

VSA_Advanced_Indicator.pine
//@version=5
indicator("VSA Volume Spread Analysis [Advanced]", overlay=true, max_bars_back=500)

// === INPUTS ===
length = input.int(20, "Volume SMA Length")
volMultiplierHigh = input.float(1.5, "High Volume Multiplier", step=0.1)
volMultiplierLow  = input.float(0.5, "Low Volume Multiplier", step=0.1)

// === CALCULATIONS ===
volSMA = ta.sma(volume, length)
volHigh = volume > volSMA * volMultiplierHigh
volLow = volume < volSMA * volMultiplierLow

spread = high - low
body = math.abs(close - open)
clv = close == high and close == low ? 0 : (2 * close - high - low) / (high - low)  // Close Location Value

// === LOGIC ===

// Upthrust: Wide spread up, closes low, high volume
upthrust = volHigh and close < open and close <= low + spread * 0.3 and spread > ta.sma(spread, length)
plotshape(upthrust, style=shape.labeldown, location=location.abovebar, color=color.red, text="Upthrust", textcolor=color.white)

// No Demand: Small spread up bar, low volume, closes in upper third
noDemand = volLow and close > open and close >= high - spread * 0.3 and spread < ta.sma(spread, length)
plotshape(noDemand, style=shape.triangledown, location=location.abovebar, color=color.orange, text="No Demand", textcolor=color.white)

// Stopping Volume: Down bar on ultra-high volume, closes off low
stoppingVolume = close < open and volHigh and close > low + spread * 0.3
plotshape(stoppingVolume, style=shape.labelup, location=location.belowbar, color=color.green, text="Stopping Vol", textcolor=color.white)

// Test Bar: Down bar on low volume, closes in top 1/3
testBar = close < open and volLow and close >= high - spread * 0.3
plotshape(testBar, style=shape.triangleup, location=location.belowbar, color=color.lime, text="Test", textcolor=color.black)

// Buying Climax: Very high volume, wide spread up, but close off highs
buyingClimax = close > open and volHigh and close < high - spread * 0.3 and spread > ta.sma(spread, length)
plotshape(buyingClimax, style=shape.xcross, location=location.abovebar, color=color.fuchsia, text="BC", textcolor=color.white)

// No Supply: Small down bar on low volume, closes in bottom third
noSupply = volLow and close < open and close <= low + spread * 0.3 and spread < ta.sma(spread, length)
plotshape(noSupply, style=shape.triangleup, location=location.belowbar, color=color.blue, text="No Supply", textcolor=color.white)

// Effort to Rise: Wide spread up on high volume, closes high
effortToRise = close > open and volHigh and close >= high - spread * 0.2 and spread > ta.sma(spread, length)
plotshape(effortToRise, style=shape.circle, location=location.belowbar, color=color.teal, text="ETR", textcolor=color.white)

// Effort to Fall: Wide spread down on high volume, closes low
effortToFall = close < open and volHigh and close <= low + spread * 0.2 and spread > ta.sma(spread, length)
plotshape(effortToFall, style=shape.circle, location=location.abovebar, color=color.maroon, text="ETF", textcolor=color.white)

// Trap Up Move: Breakout above recent high but closes weak on high volume
trapUp = high > ta.highest(high[1], 10) and close < high - spread * 0.3 and volHigh
plotshape(trapUp, style=shape.labeldown, location=location.abovebar, color=color.red, text="Trap Up", textcolor=color.white)

// Trap Down Move: Break below recent low but closes strong on high volume
trapDown = low < ta.lowest(low[1], 10) and close > low + spread * 0.3 and volHigh
plotshape(trapDown, style=shape.labelup, location=location.belowbar, color=color.green, text="Trap Down", textcolor=color.white)

// === COLORING BARS ===
barcolor( upthrust         ? color.red :stoppingVolume   ? color.green : testBar          ? color.lime : noDemand         ? color.orange : noSupply         ? color.blue : buyingClimax     ? color.fuchsia :effortToRise     ? color.teal : effortToFall     ? color.maroon :trapUp           ? color.red :trapDown         ? color.green : na)

// === Optional Alerts ===
alertcondition(upthrust, title="Upthrust", message="Upthrust detected")
alertcondition(testBar, title="Test Bar", message="Test Bar detected")
alertcondition(stoppingVolume, title="Stopping Volume", message="Stopping Volume detected")
alertcondition(buyingClimax, title="Buying Climax", message="Buying Climax detected")
alertcondition(trapUp, title="Trap Up Move", message="Trap Up Move detected")
alertcondition(trapDown, title="Trap Down Move", message="Trap Down Move detected")

Overview

VSA Volume Spread Analysis calculates volume moving averages, bar spread, and close location values to categorize individual candlestick behavior relative to average trading activity. When specific conditions are met, it plots labeled shapes identifying patterns such as upthrusts, buying climaxes, tests, stopping volume, effort moves, and fakeouts. User settings allow customization of the volume moving average length and the multipliers used to define high and low volume thresholds.

Details

Published by

Mihir-Cap 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 SMA Lengthint20length
High Volume Multiplierfloat1.5volMultiplierHigh
Low Volume Multiplierfloat0.5volMultiplierLow
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

Vector Candles

by benso87
24 stars

Vector Candles is an overlay indicator that recolors price candles using PVSRA volume rules taken from the Traders Reality concept. It compares each bar's volume with the average of the previous ten bars and also checks the product of spread and volume against

Indicator v5 VolumeCandlestick patterns
Updated 4 years ago · MPL-2.0 GitHub repository of Vector Candles
23 stars

Point-Clip Unified Indicator plots breakout and directional labels on the price chart. It scores volume spikes against a volume average, range or opening-range breaks, optional VWAP or session-anchored VWAP, fast and slow EMA trend, and a higher-timeframe EMA

Indicator v6 BreakoutVolume Repaints
Updated 4 weeks ago · Custom licence GitHub repository of Point-Clip Unified Indicator
4 stars

This indicator recolors price candles from recent volume and range. It marks climax bars when current volume times range exceeds the prior ten-bar peak or volume is at least twice a ten-bar average, and rising bars at one and a half times that average. Bullish

Indicator v5 VolumeCandlestick patterns
Updated 9 months ago · None stated GitHub repository of Price-Volume Analysis

This overlay indicator draws rounded psychological price levels and optional PVSRA vector candle colors on the price chart. It plots quarter, half, and whole levels from a user-set rounding value, with separate color, line style, and width for each. Vector col

Indicator v5 Support & resistanceVolume
Updated 5 months ago · None stated GitHub repository of Level Theory + Vector Candles

Stella's Smart Money Proxy

by stella-entry
3 stars

This indicator detects institutional or large-scale market activity using candle body size and trading volume. It compares current candle bodies against a 20-period simple moving average and checks for volume spikes above an adjustable moving average filter. I

Indicator v6 VolumeCandlestick patterns
Updated 8 months ago · MIT GitHub repository of Stella's Smart Money Proxy

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