Indicator · Pine Script v4 · Own pane

VIX Fix: Double Pleasure

by samgozman

The VIX Fix Double Pleasure indicator calculates standard synthetic Williams VIX Fix to spot market bottoms and combines it with a reversed VIX Fix calculation to detect market tops.

View on GitHub

GitHub stars4on the repository
Pine versionv4older, still runs
Lines of code65
Settings7inputs
LicenceMIT
Last update4 years ago29 Jun 2022

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

65 lines of Pine Script v4 from vix-fix-double-pleasure.pine, published under MIT. Keep the author's credit and licence lines when you reuse it.

vix-fix-double-pleasure.pine
//@version=4
// 
// VIX Fix Double Pleasure by @samgozman (https://github.com/samgozman)
// 
// How to use this script: https://github.com/samgozman/vix-fix-double-pleasure
// 
// ++++++++++ Warning: The script is provided for educational purposes only. ++++++++++ //

study(title="VIX Fix: Double Pleasure + ADX filter", shorttitle="VIX Fix: Double Pleasure", overlay=false)

// ++++++++++ INPUTS ++++++++++ //
VIXFix_length = input(22, title="VIX Fix Length")
VIXFix_back = input(22, title="The number of periods among which to look for lows and highs")
plotMarks = input(title="Plot high/low marks", type=input.bool, defval=true)

useFilter = input(false, title="Use ADX filter?", group="Filter signals by ADX")
adxMinVal = input(20, title="🛠 Do not show signals if ADX is below", group="Filter signals by ADX", minval=0, maxval=100)
adxlen = input(14, title="ADX Smoothing (optional)", group="Filter signals by ADX")
dilen = input(14, title="DI Length (optional)", group="Filter signals by ADX")

// ++++++++++ LOGIC ++++++++++ //
// Vix current
VIXFix_classic = (highest(close, VIXFix_length) - low) / highest(close, VIXFix_length) * -100
VIXFix_reverse = (lowest(close, VIXFix_length) - high) / lowest(close, VIXFix_length) * -100

// ADX Filter
dirmov(len) =>
    up = change(high)
    down = -change(low)
    plusDM = na(up) ? na : (up > down and up > 0 ? up : 0)
    minusDM = na(down) ? na : (down > up and down > 0 ? down : 0)
    truerange = rma(tr, len)
    plus = fixnan(100 * rma(plusDM, len) / truerange)
    minus = fixnan(100 * rma(minusDM, len) / truerange)
    [plus, minus]
adx(dilen, adxlen) =>
    [plus, minus] = dirmov(dilen)
    sum = plus + minus
    adx = 100 * rma(abs(plus - minus) / (sum == 0 ? 1 : sum), adxlen)
sig = adx(dilen, adxlen)

// Minimaxis
isMaxUp = highest(VIXFix_reverse, VIXFix_back) == VIXFix_reverse // Top peaks
isMaxDown = lowest(VIXFix_classic, VIXFix_back) == VIXFix_classic // Top bottoms
isMinUp = lowest(VIXFix_reverse, VIXFix_back) == VIXFix_reverse // Min peaks
isMinDown = highest(VIXFix_classic, VIXFix_back) == VIXFix_classic // Min bottoms

// Signals
buySignal = isMaxDown or isMinUp
sellSignal = isMinDown or isMaxUp

// Filtred signals
buySignalFiltred = buySignal and sig > adxMinVal
sellSignalFiltred = sellSignal and sig > adxMinVal

// ++++++++++ PLOT ++++++++++ //
plot(series=VIXFix_reverse, style=plot.style_histogram, linewidth=4, color=color.new(color.teal, 20))
plot(series=VIXFix_reverse, style=plot.style_line, linewidth=4, color=color.new(color.teal, 20), title="VIX fix reversed")

plot(series=VIXFix_classic, style=plot.style_histogram, linewidth=4, color=color.new(color.red, 20))
plot(series=VIXFix_classic, style=plot.style_line, linewidth=4, color=color.new(color.red, 20), title="VIX fix classic")

// ++++++++++ PLOT - Marks ++++++++++ //
plotshape((useFilter ? sellSignalFiltred : sellSignal) and plotMarks, title="Sell", color = color.red, style=shape.circle, location=location.top, size=size.tiny)
plotshape((useFilter ? buySignalFiltred : buySignal) and plotMarks, title="Buy", color = color.green, style=shape.circle, location=location.bottom, size=size.tiny)

Overview

VIX Fix: Double Pleasure renders both metrics as histograms and lines in a separate pane. By evaluating period highs and lows over a lookback window, the indicator generates buy and sell dots at extreme readings. Traders can enable an optional ADX filter to eliminate signals during low-volatility or weak-trend market conditions. User inputs allow customisation of lookback lengths, ADX thresholds, and mark visibility.

Details

Published by

samgozman on GitHub

Type

Indicator, Pine Script v4

Draws

Separate pane below the 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
VIX Fix Lengthint22VIXFix_length
The number of periods among which to look for lows and highsint22VIXFix_back
Plot high/low marksbooltrueplotMarks
Use ADX filter?boolfalseuseFilter
🛠 Do not show signals if ADX is belowint20adxMinVal
ADX Smoothing (optional)int14adxlen
DI Length (optional)int14dilen
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
228 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

MACD-V

by harryguiacorn
220 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
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

Bubbles Indicator

by capissimo
114 stars

The Bubbles Indicator measures volatility squeezes and expansion bursts using Bollinger Bands combined with a sinusoid oscillator and RSI divergence. It processes price data through scaled Bollinger Bands to highlight volatility changes while confirming trend

Indicator v4 Volatility & bandsOscillators & momentum Repaints
Updated 1 year ago · None stated GitHub repository of Bubbles Indicator

More Volatility & bands 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