# contango_simple: Implement a Simple Contango-Based Volatility Trading Strategy In stocks: Stock Market Analysis

## Description

Implements the following volatility strategy: Each day, hold XIV if contango is greater than `xiv.cutpoint`, hold VXX if contango is less than `vxx.cutpoint`, and hold cash otherwise.

## Usage

 ```1 2 3 4 5 6``` ```contango.simple(contango, xiv.gains = NULL, vxx.gains = NULL, xiv.cutpoint = 0, vxx.cutpoint = -Inf, initial = 10000) ```

## Arguments

 `contango` Numeric vector of contango values at the end of each trading day (or week, month, etc.). `xiv.gains` Numeric vector of gains for XIV. Should be same length as `contango` and date-shifted one value to the right. For example, the first value of `xiv.gains` should be the XIV gain for the day AFTER the first contango value. `vxx.gains` Numeric vector of gains for VXX. Should be same length as `contango` and date-shifted one value to the right. For example, the first value of `vxx.gains` should be the VXX gain for the day AFTER the first contango value. `xiv.cutpoint` Numeric value giving the contango cutpoint for XIV. For example, if `xiv.cutpoint = 5`, then XIV will be held whenever contango is greater than 5. `vxx.cutpoint` Numeric value giving the contango cutpoint for VXX. For example, if `vxx.cutpoint = -5`, then VXX will be held whenever contango is less than -5. `initial` Numeric value giving the initial value of the portfolio.

## Details

You can find historical contango values from The Intelligent Investor Blog. You can click the first link at http://investing.kuchita.com/2012/06/28/xiv-data-and-pricing-model-since-vix-futures-available-2004/ to download a zip file containing an Excel spreadsheet. Then, you will need to calculate whatever version of "contango" you prefer. I typically define contango as what percent higher the second-month VIX futures are acompared to the first- month futures, i.e. dividing the "2nd mth" column by the "1st mth" column, subtracting 1, and then multiplying by 100.

I think the most common approach for contango-based volatility strategies is holding XIV (inverse volatility) when contango is above some value (e.g. 0%, 5%, or 10%), and holding cash otherwise. You can do that with this function by leaving `vxx.cutpoint` as `-Inf`. However, you may also want to hold VXX (volatility) when contango is below some value (e.g. 0%, -5%, -10%), also known as "backwardation". You can implement an XIV-only, VXX-only, or XIV and VXX strategy with this function.

To load daily gains for XIV and/or VXX, you can use `load.gains`, which uses the quantmod package  to load data from Yahoo! Finance. You will have to specify the `from` and `to` inputs to match the date range for your contango values.

## Value

A 4-element list containing the following: (1) A character vector named `holdings` indicating what fund was held each day (XIV, VXX, or cash); (2) a numeric vector named `port.gains` giving the portfolio gain for each day, which will be 0 for days that cash was held and the XIV or VXX gain for days that XIV or VXX was held; (3) a numeric vector named `port.balances` giving the portfolio balance each day; and (4) a numeric value named `trades` giving the total number of trades that were executed.

NA

## Author(s)

Dane R. Van Domelen

## References

1. Jeffrey A. Ryan (2016). quantmod: Quantitative Financial Modelling Framework. R package version 0.4-6, https://cran.r-project.org/package=quantmod.

Acknowledgment: This material is based upon work supported by the National Science Foundation Graduate Research Fellowship under Grant No. DGE-0940903.

## Examples

 `1` ```NA ```

### Example output

```Loading required package: rbenchmark
 NA
```

stocks documentation built on May 2, 2019, 5:22 p.m.