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.
1Copy the scriptPress Copy script above, or the copy button on the code below.
2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
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.
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
VIX Fix Length
int
22
VIXFix_length
The number of periods among which to look for lows and highs
int
22
VIXFix_back
Plot high/low marks
bool
true
plotMarks
Use ADX filter?
bool
false
useFilter
🛠 Do not show signals if ADX is below
int
20
adxMinVal
ADX Smoothing (optional)
int
14
adxlen
DI Length (optional)
int
14
dilen
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.
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
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
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
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
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
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