Using the Ratio between VXV and VIX we can calculate whether UVXY is in backwardation or contango.

Ratio = VXV/VIX

If Ratio < 0.923, then UVXY/VXX is in Contango, we should short the position
If Ratio > 0.923, then UVXY/VXX is in Backwardation, we should go long

Coming from Python, my C# skills are not up to par. I've got tested Python code (with numerous enhancements) that trades this strategy. Below is my feeble attempt to convert it to C# so that everyone can take advantage of it. I did not know how to pull the data from Quandl, so I left that part out.

I'd use VXX, but you can use UVXY for much greater profits, but drawdowns will be HIGH!

```using System; namespace QuantConnect.Algorithm { public class Backwardation : QCAlgorithm { // UVXY performs better with much higher drawdowns. static string symbol = "VXX"; decimal ratio = 0; // Add VXV and VIX data from Quandl or Yahoo here // YAHOO/INDEX_VIX // CBOE/VXV //RollingWindow vixdata = new RollingWindow(1); //RollingWindow vxvdata = new RollingWindow(1); public override void Initialize() { SetStartDate(2015, 2, 1); SetEndDate(2015, 9, 9); SetCash(100000); AddSecurity(SecurityType.Equity, symbol, Resolution.Minute); SetWarmup(TimeSpan.FromDays(5)); } private DateTime last = DateTime.MinValue; public void OnData(TradeBars data) { if (IsWarmingUp) return; if (Time.Date != last.Date) { last = Time; // Calculate ratio of vix to vxv here // ratio = vixdata/vxvdata; // Once we have the ratio, we decide what to do if (ratio < 0.923m) { // A ratio under 0.923 indicates contango position // sell short if (Securities [symbol].Holdings.Quantity <= 0) { SetHoldings(symbol, -1.5); } } else { // A ratio over 0.923 indicates backwardation, go long //buy if (Securities [symbol].Holdings.Quantity >= 0) { SetHoldings(symbol, 1.5); } } } } // Quandl Datahandlers /* public void OnData(Quandl data) { // Handle QUANDL DATA } */ } }```