VIX and Stochastic RSI Strategy – Volatility-Based Trading Strategy!


The “VIX and Stochastic RSI Strategy – Volatility-Based Trading Strategy” is an innovative approach to financial market analysis, combining the predictive power of volatility and momentum indicators. This strategy leverages the Vix Fix, a tool that identifies potential market bottoms and volatility spikes, with the Stochastic RSI. This momentum oscillator helps pinpoint overbought and oversold market conditions.

(To learn more about the VIX indicator, read our article)

By integrating these two powerful tools, the strategy aims to provide more accurate entry and exit signals in various market environments. The Vix Fix component captures the heightened market fear or uncertainty, while the Stochastic RSI assesses the strength of the current price trend. This combination offers a comprehensive view of market dynamics, making it a valuable strategy for traders looking to capitalize on volatility and momentum shifts.

Strategy Logic

  1. Entry Signal: The strategy generates a long (buy) signal when the filtered or aggressive alert conditions are met, indicating a potential upward price movement.
  2. Exit Signal: The strategy exits the trade when overbought, per the Stochastic indicator (stochastic crossover above 80).

Below is the VIX and Stochastic RSI Strategy presented in TradingView:

vix strategy on Tesla

 

Below is Apple’s stock and VIX strategy:

apple stock and VIX RSI strategy

Here is the code from the Tradingview website:

//@version=2
strategy("Vix FIX / StochRSI Strategy", pyramiding=9, initial_capital=10000, default_qty_type=strategy.percent_of_equity, default_qty_value=3, overlay=false)

///////////// Stochastic Slow
Stochlength = input(14, minval=1, title="lookback length of Stochastic")
StochOverBought = input(80, title="Stochastic overbought condition")
StochOverSold = input(20, title="Stochastic oversold condition")
smoothK = input(3, title="smoothing of Stochastic %K ")
smoothD = input(3, title="moving average of Stochastic %K")
k = sma(stoch(close, high, low, Stochlength), smoothK)
d = sma(k, smoothD)

 
///////////// RSI 
RSIlength = input( 14, minval=1 , title="lookback length of RSI")
RSIOverBought = input( 70  , title="RSI overbought condition")
RSIOverSold = input( 30  , title="RSI oversold condition")
RSIprice = close
vrsi = rsi(RSIprice, RSIlength)

///////////// Double strategy: RSI strategy + Stochastic strategy

pd = input(22, title="LookBack Period Standard Deviation High")
bbl = input(20, title="Bolinger Band Length")
mult = input(2.0    , minval=1, maxval=5, title="Bollinger Band Standard Devaition Up")
lb = input(50  , title="Look Back Period Percentile High")
ph = input(.85, title="Highest Percentile - 0.90=90%, 0.95=95%, 0.99=99%")
new = input(false, title="-------Text Plots Below Use Original Criteria-------" )
sbc = input(false, title="Show Text Plot if WVF WAS True and IS Now False")
sbcc = input(false, title="Show Text Plot if WVF IS True")
new2 = input(false, title="-------Text Plots Below Use FILTERED Criteria-------" )
sbcFilt = input(true, title="Show Text Plot For Filtered Entry")
sbcAggr = input(true, title="Show Text Plot For AGGRESSIVE Filtered Entry")
ltLB = input(40, minval=25, maxval=99, title="Long-Term Look Back Current Bar Has To Close Below This Value OR Medium Term--Default=40")
mtLB = input(14, minval=10, maxval=20, title="Medium-Term Look Back Current Bar Has To Close Below This Value OR Long Term--Default=14")
str = input(3, minval=1, maxval=9, title="Entry Price Action Strength--Close > X Bars Back---Default=3")
//Alerts Instructions and Options Below...Inputs Tab
new4 = input(false, title="-------------------------Turn On/Off ALERTS Below---------------------" )
new5 = input(false, title="----To Activate Alerts You HAVE To Check The Boxes Below For Any Alert Criteria You Want----")
sa1 = input(false, title="Show Alert WVF = True?")
sa2 = input(false, title="Show Alert WVF Was True Now False?")
sa3 = input(false, title="Show Alert WVF Filtered?")
sa4 = input(false, title="Show Alert WVF AGGRESSIVE Filter?")

//Williams Vix Fix Formula
wvf = ((highest(close, pd)-low)/(highest(close, pd)))*100
sDev = mult * stdev(wvf, bbl)
midLine = sma(wvf, bbl)
lowerBand = midLine - sDev
upperBand = midLine + sDev
rangeHigh = (highest(wvf, lb)) * ph

//Filtered Bar Criteria
upRange = low > low[1] and close > high[1]
upRange_Aggr = close > close[1] and close > open[1]
//Filtered Criteria
filtered = ((wvf[1] >= upperBand[1] or wvf[1] >= rangeHigh[1]) and (wvf < upperBand and wvf < rangeHigh))
filtered_Aggr = (wvf[1] >= upperBand[1] or wvf[1] >= rangeHigh[1]) and not (wvf < upperBand and wvf < rangeHigh)

//Alerts Criteria
alert1 = wvf >= upperBand or wvf >= rangeHigh ? 1 : 0
alert2 = (wvf[1] >= upperBand[1] or wvf[1] >= rangeHigh[1]) and (wvf < upperBand and wvf < rangeHigh) ? 1 : 0
alert3 = upRange and close > close[str] and (close < close[ltLB] or close < close[mtLB]) and filtered ? 1 : 0
alert4 = upRange_Aggr and close > close[str] and (close < close[ltLB] or close < close[mtLB]) and filtered_Aggr ? 1 : 0

//Coloring Criteria of Williams Vix Fix
col = wvf >= upperBand or wvf >= rangeHigh ? lime : gray

isOverBought = (crossover(k,d) and k > StochOverBought) ? 1 : 0
isOverBoughtv2 = k > StochOverBought ? 1 : 0
filteredAlert = alert3 ? 1 : 0
aggressiveAlert = alert4 ? 1 : 0

plot(isOverBought, "Overbought / Crossover", style=line, color=red) 
plot(filteredAlert, "Filtered Alert", style=line, color=fuchsia) 
plot(aggressiveAlert, "Aggressive Alert", style=line, color=orange)

if (filteredAlert or aggressiveAlert)
    strategy.entry("Long", strategy.long)

if (isOverBought)
    strategy.close("Long")

    

Presented a Pine Script for a trading strategy using the TradingView platform. This strategy combines the Vix Fix indicator with Stochastic RSI to determine entry and exit points in a trading strategy. Let’s break down the key components and their functionalities:

Stochastic Slow

  • Stochlength: Determines the lookback length of the Stochastic oscillator.
  • StochOverBought and StochOverSold: Define the overbought and oversold conditions.
  • “smoothK” and “smoothD”: Control the smoothing of the Stochastic %K and the moving average of %K.
  • k and d: Calculated values of the Stochastic oscillator.

RSI (Relative Strength Index)

  • RSIlength: Lookback length of the RSI.
  • RSIOverBought and RSIOverSold: Define the overbought and oversold levels for the RSI.
  • RSIprice: The price used for RSI calculation, typically the closing price.
  • vrsi: The calculated value of the RSI.

Double Strategy: RSI + Stochastic

This part combines both the RSI and Stochastic strategies.

Williams Vix Fix Formula

  • wvf: Williams Vix Fix indicator, a measure of volatility.
  • sDev, midLine, lowerBand, upperBand: These terms calculate the standard deviation, middle line, and bands for the Williams Vix Fix.
  • rangeHigh: Determines the high range for the Williams Vix Fix.

Filtered Bar Criteria and Alerts

  • upRange, upRange_Aggr: Criteria for determining upward mFiltered
  • filtered, filtered_Aggr: Determine if the trade should be filtered based on the Williams Vix Fix and the upper band or range high.
  • alert1 to alert4: Criteria for different alerts based on the Williams Vix Fix and filtered conditions.

Strategy Execution

  • plot: Visual representation of the strategy signals.
  •  strategy.entry and strategy.close: Commands to enter or exit a trade based on the defined conditions.
Fxigor

Fxigor

Igor has been a trader since 2007. Currently, Igor works for several prop trading companies. He is an expert in financial niche, long-term trading, and weekly technical levels. The primary field of Igor's research is the application of machine learning in algorithmic trading. Education: Computer Engineering and Ph.D. in machine learning. Igor regularly publishes trading-related videos on the Fxigor Youtube channel. To contact Igor write on: igor@forex.in.rs

Trade gold and silver. Visit the broker's page and start trading high liquidity spot metals - the most traded instruments in the world.

Trade Gold & Silver

GET FREE MEAN REVERSION STRATEGY

Recent Posts