strategy · own pane · open source
Williams VIX Fix Strategy
Running…
Loading chart…
About
Williams VIX Fix panic-buy strategy: long when the VIX Fix formula (100×(highest-low)/highest) spikes above a percentile of its own recent highs.
- Designed to mark capitulation spikes and mean-reversion entries.
- Lower
Percentile(e.g. 0.7) for more frequent signals. - Combine with an oversold RSI or volume spike for confirmation.
Source code
//@version=5
strategy("Williams VIX Fix Strategy", overlay=false, initial_capital=10000, default_qty_type=strategy.percent_of_equity, default_qty_value=10, commission_type=strategy.commission.percent, commission_value=0.05)
len = input.int(22, "Lookback Length", minval=5, maxval=50, step=1)
percentile = input.float(0.85, "Percentile", minval=0.5, maxval=0.99, step=0.01)
stopPct = input.float(2, "Stop Loss %", minval=0.5, maxval=10, step=0.1)
tpPct = input.float(6, "Take Profit %", minval=0, maxval=20, step=0.1)
highestRange = ta.highest(high, len)
wvf = 100 * (highestRange - low) / highestRange
threshold = ta.highest(wvf, len) * percentile
longSignal = strategy.position_size == 0 and wvf >= threshold
exitSignal = strategy.position_size > 0 and close > ta.highest(high, len)
if longSignal
strategy.entry("Long", strategy.long)
if strategy.position_size > 0
strategy.exit("Risk", stop=stopPct > 0 ? strategy.position_avg_price * (1 - stopPct / 100) : na, limit=tpPct > 0 ? strategy.position_avg_price * (1 + tpPct / 100) : na)
if exitSignal
strategy.close("Long", comment="Range top reclaimed")
p_WVF = plot(wvf, "WVF", color=color.red, linewidth=2)
p_Threshold = plot(threshold, "Threshold", color=color.gray, linewidth=1)
plotshape(longSignal, "Long", style=shape.triangleup, location=location.belowbar, color=color.green, text="L")
plotshape(exitSignal, "Exit", style=shape.triangledown, location=location.abovebar, color=color.red, text="X")
alertcondition(longSignal, "WVF panic entry", "WVF spike above percentile threshold")
alertcondition(exitSignal, "WVF exit", "Price reclaimed the recent range high")
No comments yet.
Sign in to comment.