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.

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
// @version=3 
study(title = "MJS Volume", shorttitle="Volume+")

// Get user input
maLength = input(title="MA Length", type=integer, defval=96, minval=1)
useEMA = input(title="Use EMA (true) or SMA (false)?", type=bool, defval=true)
showMA = input(title="Show MA?", type=bool, defval=false)
volTrigger = input(title="Volume to Trigger Signal", type=integer, defval=0)
rvolTrigger = input(title="RVOL To Trigger Signal", type=float, defval=2.5)
lookback = input(title="Lookback Period", type=integer, defval=50)
useVol = input(title="Use Volume For Alerts?", type=bool, defval=false)
useRVOL = input(title="Use RVOL For Alerts?", type=bool, defval=true)
useLookback = input(title="Use Lookback For Alerts?", type=bool, defval=false)
draw = input(title="Draw Threshold?", type=bool, defval=true)

// Get order/tick volume data
vol = volume
ma = useEMA ? ema(vol, maLength) : sma(vol, maLength)
rvol =  (vol / ma)
// Generate volume signals
volAlert = useVol and vol >= volTrigger
rvolAlert = useRVOL and rvol >= rvolTrigger
lookAlert = useLookback and vol >= highest(vol, lookback)
alert = volAlert or rvolAlert or lookAlert

// Draw info to chart
plot(vol, style=columns, color=alert ? teal : gray, title="Volume Bars")
plot(showMA ? ma : na, color=#131722, transp=50, title="Volume MA")
plot(rvol, color=purple, transp=100, title="RVOL")
plot(draw and useVol ? volTrigger : na, color=blue, title="Volume Threshold")
plot(draw and useRVOL ? (rvolTrigger * ma) : na, color=#a64d79, title="RVOL Threshold")
plot(draw and useLookback ? highest(vol, lookback) : na, color=red, title="Lookback Threshold")

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

Last Updated: 21st March, 2019

Free Premium Charts!

5 1 vote
Article Rating
Notify of
Inline Feedbacks
View all comments