Catching Market Turns with SPY & VIX Divergence

Introduction

Ever wondered how to spot potential turning points in the stock market? One powerful signal emerges when the S&P 500 (SPY) makes a second lower low, but the Volatility Index (VIX) climbs higher than before. This suggests that while prices are pushing lower, fear is mounting—a perfect storm for an oversold bounce.

The Setup

  1. SPY and VIX: We monitor both the S&P 500 ETF (SPY) and the CBOE Volatility Index (VIX).
  2. Moving Average and Bollinger Bands: We use a 30-day moving average (MA) of SPY plus Bollinger bands set at ±2 standard deviations. These bands define a “reasonable” trading range for SPY.

The Signal

  • Local Minima: Identify points where SPY forms a short-term trough.
  • Second Lower Low: If SPY forms another trough lower than the first, it’s a sign of continued weakness.
  • Higher VIX: Confirm that the second low in SPY aligns with a higher VIX reading than at the first low, signalling growing fear.
  • Within ±2σ: Ensure SPY hasn’t broken too far beyond its Bollinger bands. If it’s still within the ±2σ envelope, the market might be primed for a reversion move.

Exiting the Trade
Once a position is entered, exit conditions are straightforward:

  1. SPY Rallies Above MA: If SPY closes above its 30-day moving average, momentum might be shifting back up—take the profit (or limit losses if it didn’t bounce much).
  2. SPY Breaks Below Lower Band: If SPY drops below the lower Bollinger band, the market could be in freefall, so exit to limit further downside.

Visualizing the Strategy
Below, you can see two charts illustrating how this Index Vol Divergence Strategy works.

  1. Chart 1 shows only the Entry Signals. SPY (blue line) is plotted against its Bollinger bands (dotted orange lines) and 30-day moving average (solid orange line). The VIX is displayed in green at the bottom. Green triangles indicate entry points when the second lower low plus higher VIX condition is met, while SPY remains within ±2σ.


  2. Chart 2 includes both Entry and Exit Signals. The red triangles mark exit points when SPY closes above the 30-day MA or below the lower Bollinger band.


These visuals help traders quickly see how the strategy identifies potential “buy-the-dip” opportunities and determines logical points to exit.

Why This Matters
This method combines price action (lower lows) with volatility sentiment (rising VIX). It aims to catch the moment when fear peaks and the market could bounce back. By integrating two different signals—price structure and implied volatility—it provides a unique edge for timing entries and exits.

Getting Started
We’ve encapsulated this logic in a Python function using yfinance, pandas, and matplotlib. Simply run:

from riskoptima import RiskOptima
df_signals, df_exits, returns = RiskOptima.run_index_vol_divergence_signals()

The function automatically:

  • Fetches SPY and VIX data from the specified start to end dates.
  • Identifies entry signals and exit signals.
  • Calculates returns.
  • Saves the final chart images and prints out the resulting DataFrames in the console.

Conclusion
The SPY & VIX Divergence Strategy is a practical way to detect potential buy-the-dip moments in an environment of increasing volatility. While no method is foolproof, combining price patterns with volatility insights can give you a clear, rules-based approach to timing the market. Try it out, tweak the parameters, and see if it fits your trading style!

Happy Investing!
— Jordi Corbilla

Check out the repository here:
GitHub: JordiCorbilla/index-vol-divergence-signals

Comments

Popular Posts