After finally getting a hang of the Research Notebook and Zipline in Quantopian, I decided to run some optimizations for a couple strategies. For one, since I’ve decided to have my strategies fully automated, I decided to stick with some algorithms that have worked for me. These are the SPY/TLT rotation and shorting VXX.
First off, I’ll present some results for my SPY/TLT rotation. Essentially the rules are this, if the 25 day simple moving average of close prices is above the 220 day simple moving average of close prices, I will use a certain percentage of my portfolio to long SPY: otherwise move to cash. Similarly for TLT, if the 35 SMA is greater than the 70 SMA, I will long TLT at a certain percentage: otherwise move to cash. Determining the slow and fast windows for the two ETFs was done through iterating in Research Notebook. As well, I’ve also decided to optimize the weighting between SPY/TLT using an iteration on Sharpe ratios, which produced the following heat map giving an optimal weighting of 50/50 for the ETFs.
Next, using the newly vetted VIX Spot/VIX F1 ratio, I iterated over a range of thresholds for when to enter; that is when VIX/F1 < threshold, short VXX, otherwise sit in cash. I’ve plotted the Sharpe ratios against the contango ratios to visualize the optimal threshold. An interesting discovery is that the iterations have what looks like two peaks, one at 0.97 and one at 1.005. My personal intuition is that the 1.005 ratio is the better choice given that it allows for more entries into a short position, whereas the 0.97 ratio may just have been “lucky” on the timing of entries.
In addition, since I will also be getting short volatility exposure in my TFSA, I chose to optimize the same ratio, but with longing XIV (this is due to the long-only constraint for the TFSA). The pattern is similar as expected, however, because of the nature of inverse etfs, the ratios are slightly different. In fact, the optimal VIX/F1 threshold for XIV is actually 1.015 rather than 1.005 for VXX.