Overall Statistics |
Total Trades 4283 Average Win 0.20% Average Loss -0.13% Compounding Annual Return 17.633% Drawdown 13.600% Expectancy 0.801 Net Profit 802.287% Sharpe Ratio 1.327 Probabilistic Sharpe Ratio 82.927% Loss Rate 31% Win Rate 69% Profit-Loss Ratio 1.62 Alpha 0.12 Beta 0.288 Annual Standard Deviation 0.113 Annual Variance 0.013 Information Ratio 0.275 Tracking Error 0.165 Treynor Ratio 0.522 Total Fees $6682.01 Estimated Strategy Capacity $3900000.00 Lowest Capacity Asset VTI S551B7YE6N39 |
# Trading based on CBOE vix-vxv ratio from QuantConnect.Data.Custom.CBOE import * class VirtualRedDogfish(QCAlgorithm): def Initialize(self): self.SetStartDate(2008, 1, 1) self.SetCash(100000) self.AddEquity("QQQ", Resolution.Minute).Symbol self.AddEquity("TLT", Resolution.Minute).Symbol self.AddEquity("VXX", Resolution.Minute).Symbol self.AddEquity("SPY", Resolution.Minute).Symbol self.AddEquity("TQQQ", Resolution.Minute).Symbol self.AddEquity("TMF", Resolution.Minute).Symbol self.AddEquity("UVXY", Resolution.Minute).Symbol self.AddEquity("SVXY", Resolution.Minute).Symbol self.AddEquity("SSO", Resolution.Minute).Symbol self.AddEquity("QLD", Resolution.Minute).Symbol self.AddEquity("IEF", Resolution.Minute).Symbol self.AddEquity("UBT", Resolution.Minute).Symbol self.AddEquity("VTI", Resolution.Minute).Symbol self.vix = 'CBOE/VIX' self.vxv = 'CBOE/VXV' self.AddData(QuandlVix, self.vix, Resolution.Daily) self.AddData(Quandl, self.vxv, Resolution.Daily) self.SetWarmUp(100, Resolution.Daily) self.vix_sma = self.SMA(self.vix, 1, Resolution.Daily) self.vxv_sma = self.SMA(self.vxv, 1, Resolution.Daily) self.ratio = IndicatorExtensions.Over(self.vxv_sma, self.vix_sma) self.spySMA = self.SMA("SPY", 100, Resolution.Daily) self.spySMADaily = self.SMA("SPY",400, Resolution.Hour) self.Schedule.On(self.DateRules.WeekStart("QQQ"), self.TimeRules.AfterMarketOpen("QQQ", 10), self.WeekTrade) self.Schedule.On(self.DateRules.EveryDay("SPY"), self.TimeRules.AfterMarketOpen("SPY", 10), self.DayTrade) def WeekTrade(self): if not (self.vix_sma.IsReady or self.vxv_sma.IsReady or self.ratio.IsReady): return if self.spySMA is None or not self.spySMA.IsReady: return self.SPXLHoldings = 0 self.TQQQHoldings = 0 if self.Securities["SPY"].Price >= self.spySMA.Current.Value: # self.SetHoldings("SPY",0.25) # self.SetHoldings("IEF",0) if self.ratio.Current.Value < .923: self.SetHoldings("UVXY", 0.1) self.SetHoldings("TLT", 0.0) self.SetHoldings("QQQ", 1) self.SetHoldings("IEF", 0.0) else: self.SetHoldings("UVXY", 0.0) self.SetHoldings("TLT", 0.3) self.SetHoldings("QQQ", 0.7) self.SetHoldings("IEF", 0.0) self.SetHoldings if self.Securities["SPY"].Price >= 1.1*self.spySMA.Current.Value: self.SetHoldings("UVXY", 0.05) else: # self.SetHoldings("SPY",0) # self.SetHoldings("IEF",0.25) if self.ratio.Current.Value <= .923: self.SetHoldings("UVXY", 0.10) self.SetHoldings("TLT", 0.20) self.SetHoldings("QQQ", 0.10) self.SetHoldings("IEF", 0.0) else: self.SetHoldings("UVXY", 0.0) self.SetHoldings("TLT", 0.40) self.SetHoldings("QQQ", 0.30) self.SetHoldings("IEF", 0.0) def DayTrade(self): if self.spySMADaily is None or not self.spySMADaily.IsReady: return if self.Securities["SPY"].Price >= self.spySMADaily.Current.Value: self.SetHoldings("VTI", 0.25) self.SetHoldings("IEF", 0) else: self.SetHoldings("VTI", 0) self.SetHoldings("IEF", 0.25) class QuandlVix(PythonQuandl): def __init__(self): self.ValueColumnName = "Close"