Indicator · Pine Script v4 · Own pane

Volatility Arbitrage

by capissimo

Volatility Arbitrage calculates the Rate of Change (ROC) for a selected price dataset and plots it along with upper and lower standard deviation bounds in a separate pane.

View on GitHub

GitHub stars114on the repository
Pine versionv4older, still runs
Lines of code43
Settings4inputs
LicenceNone statedfile: MPL-2.0
Last update1 year ago7 Nov 2024

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

43 lines of Pine Script v4 from scripts/107-Volatility-Arbitrage.pine, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.

107-Volatility-Arbitrage.pine
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © capissimo

//@version=4
study("Volatility Arbitrage", '', false)

// Volatility Arbitrage

// Description:

// This indicator uses rate of change (ROC) indicator together with its standard deviations.
// ROC values are cycling around zero, i.e. around the mean. 
// Two standard deviations of the ROC draw the upper and the lower bounds that serve as a threshold
// that captures outliers. These outliers can be regarded as a signal.

//-------------------- Inputs

ds     = input(close, 'Dataset')
roclag = input(5,     'ROC Lag       |1..n|', minval=1)
devlag = input(20,    'Deviation Lag |1..n|', minval=1)
mult   = input(2.0,   'Deviation Multiplier |0.1..5.0|', minval=0.1, maxval=5, step=0.1)

//-------------------- Dynamic Arrays

var float roc   = 0.0
var float upper = 0.0
var float lower = 0.0

//-------------------- Logic

ma     = sma(ds, 1)
roc   := 100.0 * (ma / nz(ma[roclag]) - 1.0)

dev    = stdev(roc, devlag)
upper := dev * mult
lower := -1.0 * upper

//-------------------- Rendering

hline(0)
plot(upper, '', color.red)
plot(lower, '', color.blue)
plot(roc,   '', color.black)

Overview

The indicator measures momentum fluctuations relative to zero and identifies statistical outliers when ROC crosses outside the standard deviation bounds, signaling potential volatility extremes. Users can customize the ROC lag, standard deviation lookback period, deviation multiplier, and source price dataset.

Details

Published by

capissimo on GitHub

Type

Indicator, Pine Script v4

Draws

Separate pane below the chart

Category

Volatility & bands, Oscillators & momentum

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
Datasetsourcecloseds
ROC Lag |1..n|int5roclag
Deviation Lag |1..n|int20devlag
Deviation Multiplier |0.1..5.0|float2.0mult
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

TTM Squeeze

by Alorse
330 stars

This indicator plots a TTM Squeeze momentum oscillator in a separate pane. It compares a Bollinger Band offset to a Keltner Channel offset and marks the zero line white when the difference is non-negative and black when the bands are inside the channel. A line

Indicator v5 Oscillators & momentumVolatility & bands
Updated 2 months ago · None stated GitHub repository of TTM Squeeze

Function - Logistic Equation

by ricardosantos79
261 stars

Calculates dynamic modeling values by applying a mathematical logistic differential equation to price change over a specified lookback length. It measures price momentum relative to the recent high-low price range. The script plots positive and negative logist

Indicator v5 Oscillators & momentumVolatility & bands
Updated 4 years ago · None stated GitHub repository of Function - Logistic Equation

MACD-V

by harryguiacorn
219 stars

MACD-V is a volatility-normalized momentum indicator based on research by Alex Spiroglou. It calculates the standard MACD histogram and normalizes it by dividing by the Average True Range (ATR). Plotted in a separate pane as a colored histogram, it includes us

Indicator v5 Oscillators & momentumVolatility & bands
Updated 1 year ago · None stated GitHub repository of MACD-V
218 stars

This indicator detects a Bollinger Band squeeze when the bands sit inside Keltner Channels, marking low volatility. It plots red dots during a squeeze and green dots when the bands are outside, in a separate pane. An optional histogram shows momentum as the cl

Indicator v6 Volatility & bandsOscillators & momentum
Updated 3 months ago · None stated GitHub repository of Bollinger Band Squeeze Detector
147 stars

This indicator generates trade entry signals and target levels optimized for 1-hour timeframes, designed for external signal extraction. It calculates 7-period and 16-period EMAs alongside 10-period RSI and ATR filters. Long signals occur when the fast EMA cro

Indicator v5 TrendOscillators & momentum
Updated 6 weeks ago · MIT GitHub repository of Signal Strategy 100 Candles of 1H Timeframe

This indicator plots an oscillator in a separate pane. It builds several SuperTrend series across a user-defined factor range and step, using ATR as the band width. On each bar it measures the distance between the close and each SuperTrend output, then groups

Indicator v5 TrendVolatility & bands
Updated 2 years ago · GPL-3.0 GitHub repository of AI SuperTrend Clustering Oscillator [LuxAlgo]

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