Indicator · Pine Script v5 · On the chart

Relative Volume

by ryangaraygay

Relative Volume calculates an exponential moving average and standard deviation of volume over a user-defined lookback period to identify statistical volume anomalies.

View on GitHub

GitHub stars2on the repository
Pine versionv5runs as is
Lines of code28
Settings2inputs
LicenceMIT
Last update1 year ago10 Apr 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

28 lines of Pine Script v5 from unusual-volume-overlay.pine, published under MIT. Keep the author's credit and licence lines when you reuse it.

unusual-volume-overlay.pine
//@version=5
indicator("Relative Volume", shorttitle = "RLTV VOL", overlay = true)

volume_lookback = input.int(20, "Volume Lookback")
min_volume_threshold = input.int(1000, "Minimum Volume Threshold")

volume_avg = ta.ema(volume, volume_lookback)
volume_stdev = ta.stdev(volume, volume_lookback)

volume_diff = (volume - volume_avg)
volume_threshold = (1.0*volume_stdev)
unusual_volume = math.abs(volume_diff) > volume_threshold
extreme_volume = (math.abs(volume_diff) > 2.0*volume_stdev)

aboveVolume = volume_diff > volume_threshold
belowVolume = volume_diff < -volume_threshold

aboveMinimumThreshold = volume > min_volume_threshold

volume_transparency = aboveMinimumThreshold ? (extreme_volume ? 0 : 80) : 100
volume_signal_color = if aboveVolume
    color.new(color.aqua, volume_transparency)
else if belowVolume
    color.new(color.fuchsia, volume_transparency)

plotshape(unusual_volume,style=shape.circle,color=volume_signal_color, size = size.tiny, location = location.belowbar)

alertcondition(aboveMinimumThreshold and extreme_volume and aboveVolume, "Significant Volume Alert", "{{exchange}}:{{ticker}} volume of {{volume}} is 2 standard deviations above average.")

Overview

When volume exceeds standard deviation thresholds and meets a minimum volume level, the indicator plots colored circles below price bars on the main chart. Aqua circles represent high volume above average, while fuchsia circles indicate volume below average deviation. It includes configurable lookback and threshold settings alongside custom alert conditions.

Details

Published by

ryangaraygay on GitHub

Type

Indicator, Pine Script v5

Draws

On the price chart

Category

Volume

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 Lookbackint20volume_lookback
Minimum Volume Thresholdint1000min_volume_threshold
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

Calculates an Elastic Volume Weighted Moving Average (EVWMA), incorporating trading volume to dynamically adjust moving average responsiveness over a specified lookback length. It plots directly on the price chart as a single moving average line. Optional colo

Indicator v4 Moving averagesVolume
Updated 10 days ago · GPL-3.0 GitHub repository of Elastic Volume Weighted Moving Average

This overlay indicator screens a pasted list of up to forty symbols and draws a table on the price chart. It classifies bullish or bearish setups from the percent change between the current candle and the candle 250 bars back, then shows RSI with a simple movi

Indicator v5 Oscillators & momentumVolume
Updated 1 year ago · MPL-2.0 GitHub repository of Momentum Setup - Ankush Bajaj Momentum Investing Setup

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

META-tracker

by Allen1212
303 stars

This indicator overlays historical ARK Invest buy and sell events for META on the price chart. It places green labels below bars for purchases and red labels above bars for sales, with a same-day count of how many selected ARK ETFs traded the stock. The ETF in

Indicator v4 Volume
Updated 2 years ago · None stated GitHub repository of META-tracker
219 stars

An educational Pine Script v4 indicator demonstrating how to plot volume histograms on the main price chart using unscaled axes. The code includes examples and commented templates for creating vertical line markers at specific dates or time zones, such as mark

Indicator v4 Sessions & timeVolume
Updated 5 years ago · None stated GitHub repository of 教學-畫垂直線1

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