<p><div><div><div><div data-show-faces="false" data-height="21" data-width="100" data-layout="button_count" data-send="true" data-href="https://www.r-bloggers.com/comparing-some-strategies-from-easy-volatility-investing-and-the-table-drawdowns-command/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="https://quantstrattrader.wordpress.com/2017/11/14/comparing-some-strategies-from-easy-volatility-investing-and-the-table-drawdowns-command/"> R – QuantStrat TradeR</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p>This post will be about comparing strategies from the paper <a rel="nofollow" href="http://www.naaim.org/wp-content/uploads/2013/10/00R_Easy-Volatility-Investing-+-Abstract-Tony-Cooper.pdf" target="_blank">“Easy Volatility Investing”,</a> along with a demonstration of R’s table.Drawdowns command. </p>
<p>First off, before going further, while I think the execution assumptions found in EVI don’t lend the strategies well to actual live trading (although their risk/reward tradeoffs also leave a lot of room for improvement), I think these strategies are great as benchmarks.</p>
<p>So, some time ago, I did an out-of-sample test for one of the strategies found in EVI, which can be found <a rel="nofollow" href="https://quantstrattrader.wordpress.com/2017/06/20/an-out-of-sample-update-on-ddns-volatility-momentum-trading-strategy-and-beta-convexity/" target="_blank">here</a>. </p>
<p>Using the same source of data, I also obtained data for SPY (though, again, <a rel="nofollow" href="https://quantstrattrader.wordpress.com/2017/10/23/the-return-of-free-data-and-possible-volatility-trading-subscription/" target="_blank">AlphaVantage can also provide this service for free </a>for those that don’t use Quandl).</p>
<p>Here’s the new code.</p>
<pre>
require(downloader)
require(quantmod)
require(PerformanceAnalytics)
require(TTR)
require(Quandl)
require(data.table)

download(&quot;http://www.cboe.com/publish/scheduledtask/mktdata/datahouse/vix3mdailyprices.csv&quot;, destfile=&quot;vxvData.csv&quot;)

VIX &lt;- fread(&quot;http://www.cboe.com/publish/scheduledtask/mktdata/datahouse/vixcurrent.csv&quot;, skip = 1)
VIXdates &lt;- VIX$Date
VIX$Date &lt;- NULL; VIX &lt;- xts(VIX, order.by=as.Date(VIXdates, format = '%m/%d/%Y'))

vxv &lt;- xts(read.zoo(&quot;vxvData.csv&quot;, header=TRUE, sep=&quot;,&quot;, format=&quot;%m/%d/%Y&quot;, skip=2))

ma_vRatio &lt;- SMA(Cl(VIX)/Cl(vxv), 10)
xivSigVratio &lt;- ma_vRatio &lt; 1 
vxxSigVratio &lt;- ma_vRatio > 1 

# V-ratio (VXV/VXMT)
vRatio &lt;- lag(xivSigVratio) * xivRets + lag(vxxSigVratio) * vxxRets
# vRatio &lt;- lag(xivSigVratio, 2) * xivRets + lag(vxxSigVratio, 2) * vxxRets


# Volatility Risk Premium Strategy
spy &lt;- Quandl(&quot;EOD/SPY&quot;, start_date='1990-01-01', type = 'xts')
spyRets &lt;- Return.calculate(spy$Adj_Close)
histVol &lt;- runSD(spyRets, n = 10, sample = FALSE) * sqrt(252) * 100
vixDiff &lt;- Cl(VIX) - histVol
maVixDiff &lt;- SMA(vixDiff, 5)

vrpXivSig &lt;- maVixDiff > 0 
vrpVxxSig &lt;- maVixDiff &lt; 0
vrpRets &lt;- lag(vrpXivSig, 1) * xivRets + lag(vrpVxxSig, 1) * vxxRets


obsCloseMomentum &lt;- magicThinking # from previous post

compare &lt;- na.omit(cbind(xivRets, obsCloseMomentum, vRatio, vrpRets))
colnames(compare) &lt;- c(&quot;BH_XIV&quot;, &quot;DDN_Momentum&quot;, &quot;DDN_VRatio&quot;, &quot;DDN_VRP&quot;)
</pre>
<p>So, an explanation: there are four return streams here–buy and hold XIV, the DDN momentum from a <a rel="nofollow" href="https://quantstrattrader.wordpress.com/2017/06/20/an-out-of-sample-update-on-ddns-volatility-momentum-trading-strategy-and-beta-convexity/" target="_blank">previous post</a>, and two other strategies. </p>
<p>The simpler one, called the VRatio is simply the ratio of the VIX over the VXV. Near the close, check this quantity. If this is less than one, buy XIV, otherwise, buy VXX. </p>
<p>The other one, called the Volatility Risk Premium strategy (or VRP for short), compares the 10 day historical volatility (that is, the annualized running ten day standard deviation) of the S&amp;P 500, subtracts it from the VIX, and takes a 5 day moving average of that. Near the close, when that’s above zero (that is, VIX is higher than historical volatility), go long XIV, otherwise, go long VXX. </p>
<p>Again, all of these strategies are effectively “observe near/at the close, buy at the close”, so are useful for demonstration purposes, though not for implementation purposes on any large account without incurring market impact.</p>
<p>Here are the results, since 2011 (that is, around the time of XIV’s actual inception):<br>
<img data-orig-file="https://quantstrattrader.files.wordpress.com/2017/11/easyvolinvesting.png?w=456" data-orig-size="909,539" data-medium-file="https://quantstrattrader.files.wordpress.com/2017/11/easyvolinvesting.png?w=456?w=300" data-attachment-id="1463" data-image-meta="{" data-image-description="" src="https://quantstrattrader.files.wordpress.com/2017/11/easyvolinvesting.png?w=456" data-permalink="https://quantstrattrader.wordpress.com/2017/11/14/comparing-some-strategies-from-easy-volatility-investing-and-the-table-drawdowns-command/easyvolinvesting/#main" data-large-file="https://quantstrattrader.files.wordpress.com/2017/11/easyvolinvesting.png?w=456?w=640" alt="easyVolInvesting" data-image-title="easyVolInvesting" sizes="(max-width: 640px) 100vw, 640px" data-comments-opened="1" class="wp-image-1463" data-recalc-dims="1"></p>
<p>To note, both the momentum and the VRP strategy underperform buying and holding XIV since 2011. The VRatio strategy, on the other hand, does outperform.</p>
<p>Here’s a summary statistics function that compiles some top-level performance metrics.</p>
<pre>
stratStats &lt;- function(rets) {
  stats &lt;- rbind(table.AnnualizedReturns(rets), maxDrawdown(rets))
  stats[5,] &lt;- stats[1,]/stats[4,]
  stats[6,] &lt;- stats[1,]/UlcerIndex(rets)
  rownames(stats)[4] &lt;- &quot;Worst Drawdown&quot;
  rownames(stats)[5] &lt;- &quot;Calmar Ratio&quot;
  rownames(stats)[6] &lt;- &quot;Ulcer Performance Index&quot;
  return(stats)
}
</pre>
<p>And the result:</p>
<pre>
> stratStats(compare['2011::'])
                             BH_XIV DDN_Momentum DDN_VRatio   DDN_VRP
Annualized Return         0.3801000    0.2837000  0.4539000 0.2572000
Annualized Std Dev        0.6323000    0.5706000  0.6328000 0.6326000
Annualized Sharpe (Rf=0%) 0.6012000    0.4973000  0.7172000 0.4066000
Worst Drawdown            0.7438706    0.6927479  0.7665093 0.7174481
Calmar Ratio              0.5109759    0.4095285  0.5921650 0.3584929
Ulcer Performance Index   1.1352168    1.2076995  1.5291637 0.7555808
</pre>
<p>To note, all of the benchmark strategies suffered very large drawdowns since XIV’s inception, which we can examine using the table.Drawdowns command, as seen below:</p>
<pre>
> table.Drawdowns(compare[,1]['2011::'], top = 5)
        From     Trough         To   Depth Length To Trough Recovery
1 2011-07-08 2011-11-25 2012-11-26 -0.7439    349        99      250
2 2015-06-24 2016-02-11 2016-12-21 -0.6783    379       161      218
3 2014-07-07 2015-01-30 2015-06-11 -0.4718    236       145       91
4 2011-02-15 2011-03-16 2011-04-20 -0.3013     46        21       25
5 2013-04-15 2013-06-24 2013-07-22 -0.2877     69        50       19
> table.Drawdowns(compare[,2]['2011::'], top = 5)
        From     Trough         To   Depth Length To Trough Recovery
1 2014-07-07 2016-06-27 2017-03-13 -0.6927    677       499      178
2 2012-03-27 2012-06-13 2012-09-13 -0.4321    119        55       64
3 2011-10-04 2011-10-28 2012-03-21 -0.3621    117        19       98
4 2011-02-15 2011-03-16 2011-04-21 -0.3013     47        21       26
5 2011-06-01 2011-08-04 2011-08-18 -0.2723     56        46       10
> table.Drawdowns(compare[,3]['2011::'], top = 5)
        From     Trough         To   Depth Length To Trough Recovery
1 2014-01-23 2016-02-11 2017-02-14 -0.7665    772       518      254
2 2011-09-13 2011-11-25 2012-03-21 -0.5566    132        53       79
3 2012-03-27 2012-06-01 2012-07-19 -0.3900     80        47       33
4 2011-02-15 2011-03-16 2011-04-20 -0.3013     46        21       25
5 2013-04-15 2013-06-24 2013-07-22 -0.2877     69        50       19
> table.Drawdowns(compare[,4]['2011::'], top = 5)
        From     Trough         To   Depth Length To Trough Recovery
1 2015-06-24 2016-02-11 2017-10-11 -0.7174    581       161      420
2 2011-07-08 2011-10-03 2012-02-03 -0.6259    146        61       85
3 2014-07-07 2014-12-16 2015-05-21 -0.4818    222       115      107
4 2013-02-20 2013-07-08 2014-06-10 -0.4108    329        96      233
5 2012-03-27 2012-06-01 2012-07-17 -0.3900     78        47       31
</pre>
<p>Note that the table.Drawdowns command only examines one return stream at a time. Furthermore, the top argument specifies how many drawdowns to look at, sorted by greatest drawdown first.</p>
<p>One reason I think that these strategies seem to suffer the drawdowns they do is that they’re either all-in on one asset, or its exact opposite, with no room for error. </p>
<p>One last thing, for the curious, here is the comparison with my strategy since 2011 (essentially XIV inception) benchmarked against the strategies in EVI (which I have been trading with live capital since September, and have recently opened a <a rel="nofollow" href="https://www.patreon.com/quantstrattrader" target="_blank">subscription service</a> for):</p>
<p><img data-orig-file="https://quantstrattrader.files.wordpress.com/2017/11/volperfbenchmarks.png?w=456" data-orig-size="909,539" data-medium-file="https://quantstrattrader.files.wordpress.com/2017/11/volperfbenchmarks.png?w=456?w=300" data-attachment-id="1487" data-image-meta="{" data-image-description="" src="https://quantstrattrader.files.wordpress.com/2017/11/volperfbenchmarks.png?w=456" data-permalink="https://quantstrattrader.wordpress.com/2017/11/14/comparing-some-strategies-from-easy-volatility-investing-and-the-table-drawdowns-command/volperfbenchmarks/#main" data-large-file="https://quantstrattrader.files.wordpress.com/2017/11/volperfbenchmarks.png?w=456?w=640" alt="volPerfBenchmarks" data-image-title="volPerfBenchmarks" sizes="(max-width: 640px) 100vw, 640px" data-comments-opened="1" class="wp-image-1487" data-recalc-dims="1"></p>
<pre>
stratStats(compare['2011::'])
                             QST_vol    BH_XIV DDN_Momentum DDN_VRatio   DDN_VRP
Annualized Return          0.8133000 0.3801000    0.2837000  0.4539000 0.2572000
Annualized Std Dev         0.3530000 0.6323000    0.5706000  0.6328000 0.6326000
Annualized Sharpe (Rf=0%)  2.3040000 0.6012000    0.4973000  0.7172000 0.4066000
Worst Drawdown             0.2480087 0.7438706    0.6927479  0.7665093 0.7174481
Calmar Ratio               3.2793211 0.5109759    0.4095285  0.5921650 0.3584929
Ulcer Performance Index   10.4220721 1.1352168    1.2076995  1.5291637 0.7555808
</pre>
<p>Thanks for reading.</p>
<p>NOTE: I am currently looking for networking and full-time opportunities related to my skill set. My LinkedIn profile can be found <a rel="nofollow" href="https://www.linkedin.com/in/ilyakipnis/" target="_blank">here</a>.</p>
<p> <a rel="nofollow" href="https://feeds.wordpress.com/1.0/gocomments/quantstrattrader.wordpress.com/1434/" target="_blank"><img border="0" alt="" src="https://feeds.wordpress.com/1.0/comments/quantstrattrader.wordpress.com/1434/"></a> <img border="0" alt="" src="https://i1.wp.com/pixel.wp.com/b.gif?resize=1%2C1&ssl=1" data-recalc-dims="1"></p>
	<p>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="https://quantstrattrader.wordpress.com/2017/11/14/comparing-some-strategies-from-easy-volatility-investing-and-the-table-drawdowns-command/"> R – QuantStrat TradeR</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a rel="nofollow" href="https://www.r-project.org/" title="The R Project for Statistical Computing">R</a> news and <a rel="nofollow" href="https://www.r-bloggers.com/search/tutorial" title="R tutorials">tutorials</a> on topics such as: <a rel="nofollow" href="https://www.r-bloggers.com/search/data%20science" title="Data science">Data science</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data" title="Big Data">Big Data, <a rel="nofollow" href="https://www.r-users.com/" title="R jobs">R jobs</a>, visualization (<a rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2" title="ggplot and ggplot2 tutorials">ggplot2</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/boxplot" title="Boxplots using lattice and ggplot2 tutorials">Boxplots</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/map" title="Maps and gis">maps</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/animation" title="Animation in R">animation</a>), programming (<a rel="nofollow" href="https://www.r-bloggers.com/search/RStudio" title="RStudio IDE for R">RStudio</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/sweave" title="Sweave and literate programming">Sweave</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX" title="LaTeX in R">LaTeX</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/SQL" title="SQL and databases">SQL</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/eclipse" title="Eclipse IDE for R">Eclipse</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/git" title="git and github, Version Control System">git</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/hadoop" title="Large data in R using Hadoop">hadoop</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping" title="Web Scraping of google, facebook, yahoo, twitter and more using R">Web Scraping</a>) statistics (<a rel="nofollow" href="https://www.r-bloggers.com/search/regression" title="Regressions and ANOVA analysis tutorials">regression</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/PCA" title="principal component analysis tutorial">PCA</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/time+series" title="Time series">time series</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/trading" title="finance trading">trading</a>) and more...
<img alt="" width="1" src="http://feeds.feedburner.com/~r/RBloggers/~4/57-pUNpdkCk" height="1"></a></div>