Volume+ (RVOL / Alerts) Indicator

This is a trading tool that I use quite often particularly for cryptocurrency and stock trading.

It is an enhanced volume indicator with extra features. You can use it to determine RVOL (Relative Volume), detect volume spikes and other irregular activity. Includes alert functionality.

If you like this script, you may also be interested in my RVOL By Time indicator:

How It Works

This RVOL indicator is quite simple. When volume rises above any one of the three given thresholds, the volume bar changes color. You can also set alerts with this script so that you get notified whenever this occurs.

You can use one, two or all three of the thresholds at the same time.


MA Length:
This sets the moving average length to use for determining RVOL.

Use EMA (true) or SMA (false):
If enabled, the MA will be an Exponential Moving Average. If disabled, the MA will be a Simple Moving Average.

Show MA?
If enabled, the script will draw the moving average to the chart.

Volume To Trigger Signal:
This sets the volume amount to trigger a signal. (Blue line).

RVOL To Trigger Signal:
This tells the script what RVOL value should trigger a signal. RVOL is calculated by multiplying this value by the current moving average value. (Purple line).

Lookback Period:
This sets how far back the script looks for volume highs to draw the channel. (Red line).

Use Volume For Alerts?
If enabled, then volume amounts will trigger alerts.

Use RVOL For Alerts?
If enabled, then when RVOL gets above the threshold an alert will be triggered.

Use Lookback For Alerts?
If enabled, then when a volume candle closes above the previous highest volume candle for the lookback period, an alert will be triggered.

Draw Threshold?
If disabled then the script will not draw the threshold lines on the chart. Volume bars will still change color if a signal is detected.

How To Set Alerts

If you have any trouble setting alerts, try reading this article where I explain in detail how TradingView’s alert system works.

Pine Script Basics Course Pine Script Mastery Course

Source Code

// Created by Matthew J. Slabosz
// www.zenandtheartoftrading.com
// Last Updated: 9th October, 2020
// @version=4
study(title="RVOL", overlay=false)

// Get user input
lookback = input(title="Lookback Period", type=input.integer, defval=50)
maLength = input(title="MA Length", type=input.integer, defval=50, minval=1)
maType = input(title="MA Type", type=input.string, defval="EMA", options=["EMA", "SMA", "HMA", "WMA", "DEMA"])
volTrigger = input(title="Volume to Trigger Signal", type=input.integer, defval=0)
rvolTrigger = input(title="RVOL To Trigger Signal", type=input.float, defval=2.5)
useVol = input(title="Use Static Volume For Alerts?", type=input.bool, defval=false)
useRVOL = input(title="Use RVOL For Alerts?", type=input.bool, defval=true)
useLookback = input(title="Use Lookback For Alerts?", type=input.bool, defval=false)
showRVOL = input(title="Draw RVOL Threshold?", type=input.bool, defval=true)

// Get Moving Average From Settings Menu
getMA(length) =>
    maPrice = ema(volume, length)
    if maType == "SMA"
        maPrice := sma(volume, length)
    if maType == "HMA"
        maPrice := hma(volume, length)
    if maType == "WMA"
        maPrice := wma(volume, length)
    if maType == "DEMA"
        e1 = ema(volume, length)
        e2 = ema(e1, length)
        maPrice := 2 * e1 - e2

// Get volume data
ma = getMA(maLength)
rvol = volume / ma

// Generate volume alerts / signals
highestVolume = highest(volume, lookback)
volAlert = useVol and volume >= volTrigger
rvolAlert = useRVOL and rvol >= rvolTrigger
lookbackAlert = useLookback and volume >= highestVolume
alert = volAlert or rvolAlert or lookbackAlert

// Draw info to chart
plot(volume, style=plot.style_columns, color=alert ? color.teal : color.gray, title="Volume Bars")
plot(ma, color=#131722, transp=50, display=display.none, title="Volume MA")
plot(rvol, color=color.purple, transp=100, title="RVOL")
plot(showRVOL and useVol ? volTrigger : na, color=color.blue, title="Volume Threshold")
plot(showRVOL and useRVOL ? rvolTrigger * ma : na, color=#a64d79, title="RVOL Threshold")
plot(showRVOL and useLookback ? highestVolume : na, color=color.red, title="Lookback Threshold")

// Send out an alert if this candle meets our conditions
alertcondition(alert, title="Volume Alert!", message="RVOL signal for {{ticker}}")

Last Updated: 9th October, 2020

Free Premium Charts!

5 1 vote
Article Rating
Notify of
1 Comment
Newest Most Voted
Inline Feedbacks
View all comments
2 years ago

Very nice indicator.

Do you have an indicator which highlights the candlesticks on the price chart for the triggered volume?