PJ Sutherland's Synthetic VIX

In the recent interview of PJ Sutherland on the Better System Trader podcast he talked about a synthetic VIX indicator that he uses on indices other than the S&P. This concept seemed interesting to me so I coded it up and decided to share, I'm very inexperienced with Python so I'm sure there is a much more elegant way to code this but it does work and you can see the strong correlation with the VIX. I added the SynVIX to a simple SPY/zero beta SMA crossover strategy so you can see it in action.

    high = data.history(context.VIXref, 'high', 20, '1d')
low = data.history(context.VIXref, 'low', 20, '1d')
close = data.history(context.VIXref, 'close', 20, '1d')
TR1 = (high[0] - low[0]) / close[0]
TR2 = (high[1] - low[1]) / close[1]
TR3 = (high[2] - low[2]) / close[2]
TR4 = (high[3] - low[3]) / close[3]
TR5 = (high[4] - low[4]) / close[4]
TR6 = (high[5] - low[5]) / close[5]
TR7 = (high[6] - low[6]) / close[6]
TR8 = (high[7] - low[7]) / close[7]
TR9 = (high[8] - low[8]) / close[8]
TR10 = (high[9] - low[9]) / close[9]
TR11 = (high[10] - low[10]) / close[10]
TR12 = (high[11] - low[11]) / close[11]
TR13 = (high[12] - low[12]) / close[12]
TR14 = (high[13] - low[13]) / close[13]
TR15 = (high[14] - low[14]) / close[14]
TR16 = (high[15] - low[15]) / close[15]
TR17 = (high[16] - low[16]) / close[16]
TR18 = (high[17] - low[17]) / close[17]
TR19 = (high[18] - low[18]) / close[18]
TR20 = (high[19] - low[19]) / close[19]
SynVIX = (TR1+TR2+TR3+TR4+TR5+TR6+TR7+TR8+TR9+TR10+TR11+TR12+TR13+TR14+TR15+TR16+TR17+TR18+TR19+TR20).mean()

11
Backtest from to with initial capital
Total Returns
--
Alpha
--
Beta
--
Sharpe
--
Sortino
--
Max Drawdown
--
Benchmark Returns
--
Volatility
--
 Returns 1 Month 3 Month 6 Month 12 Month
 Alpha 1 Month 3 Month 6 Month 12 Month
 Beta 1 Month 3 Month 6 Month 12 Month
 Sharpe 1 Month 3 Month 6 Month 12 Month
 Sortino 1 Month 3 Month 6 Month 12 Month
 Volatility 1 Month 3 Month 6 Month 12 Month
 Max Drawdown 1 Month 3 Month 6 Month 12 Month
# Backtest ID: 5830a63b69fa4248e0b002bc
There was a runtime error.
5 responses

The beauty of arrays in python that you can manipulate things "vector based" like this:

    vix_close = data.current('v','price')
high = data.history(context.VIXref, 'high', 20, '1d')
low = data.history(context.VIXref, 'low', 20, '1d')
close = data.history(context.VIXref, 'close', 20, '1d')
SynVIX = ((high-low)/close).mean()

14
Backtest from to with initial capital
Total Returns
--
Alpha
--
Beta
--
Sharpe
--
Sortino
--
Max Drawdown
--
Benchmark Returns
--
Volatility
--
 Returns 1 Month 3 Month 6 Month 12 Month
 Alpha 1 Month 3 Month 6 Month 12 Month
 Beta 1 Month 3 Month 6 Month 12 Month
 Sharpe 1 Month 3 Month 6 Month 12 Month
 Sortino 1 Month 3 Month 6 Month 12 Month
 Volatility 1 Month 3 Month 6 Month 12 Month
 Max Drawdown 1 Month 3 Month 6 Month 12 Month
# Backtest ID: 583231f727cfbc4815993bbd
There was a runtime error.

I knew there must be a cleaner way to code this up, thanks Peter and thanks for your work on the volatility strategies as well, I like those algos quite a bit. It's interesting that the math ended up to be a bit different between our two versions, I think I'll tweak the date ranges a bit and see if I can increase the correlation any further.

Here is another version of "Synthetic VIX" as ATR to Price Ratio which I use for years.

13
Backtest from to with initial capital
Total Returns
--
Alpha
--
Beta
--
Sharpe
--
Sortino
--
Max Drawdown
--
Benchmark Returns
--
Volatility
--
 Returns 1 Month 3 Month 6 Month 12 Month
 Alpha 1 Month 3 Month 6 Month 12 Month
 Beta 1 Month 3 Month 6 Month 12 Month
 Sharpe 1 Month 3 Month 6 Month 12 Month
 Sortino 1 Month 3 Month 6 Month 12 Month
 Volatility 1 Month 3 Month 6 Month 12 Month
 Max Drawdown 1 Month 3 Month 6 Month 12 Month
# Backtest ID: 5832b0c4975c5367411357f4
There was a runtime error.

Very cool Vladimir, do you find this useful on just stock indices or other securities as well?

Looks similar to WVIX I tried here but ran into issues:
https://www.quantopian.com/posts/global-context-variable-timestamping-data-creep

Using the two methods above in the two algos, on day 1, do not have a X day lookback available, so attempted using pipeline and a global context variable to set up a df on day 1, but ran into issues where it looked like the GCV df populated throughout testing period at inception so when pulling data from there, dates are off - after time stamp, log shows on Nov 13/09, that the gcv last 10 slice has data all the way out to May 13, 2010... can fix with a date match, but not sure if this was the most efficient way to put it together.

1
Backtest from to with initial capital
Total Returns
--
Alpha
--
Beta
--
Sharpe
--
Sortino
--
Max Drawdown
--
Benchmark Returns
--
Volatility
--
 Returns 1 Month 3 Month 6 Month 12 Month
 Alpha 1 Month 3 Month 6 Month 12 Month
 Beta 1 Month 3 Month 6 Month 12 Month
 Sharpe 1 Month 3 Month 6 Month 12 Month
 Sortino 1 Month 3 Month 6 Month 12 Month
 Volatility 1 Month 3 Month 6 Month 12 Month
 Max Drawdown 1 Month 3 Month 6 Month 12 Month
# Backtest ID: 5832b732dcc611638738f69a
There was a runtime error.