Overall Statistics |
Total Trades 5668 Average Win 0.38% Average Loss -1.18% Compounding Annual Return 49.026% Drawdown 47.200% Expectancy 0.156 Net Profit 9896.697% Sharpe Ratio 1.234 Probabilistic Sharpe Ratio 49.583% Loss Rate 13% Win Rate 87% Profit-Loss Ratio 0.32 Alpha 0.414 Beta 0.726 Annual Standard Deviation 0.415 Annual Variance 0.172 Information Ratio 0.942 Tracking Error 0.401 Treynor Ratio 0.704 Total Fees $78804.30 Estimated Strategy Capacity $15000000.00 Lowest Capacity Asset TQQQ UK280CGTCB51 |
# Trading based on CBOE vix-vxv ratio from QuantConnect.Data.Custom.CBOE import * class VirtualRedDogfish(QCAlgorithm): def Initialize(self): self.SetStartDate(2010, 1, 1) self.SetCash(100000) self.AddEquity("TQQQ", Resolution.Minute).Symbol self.AddEquity("TMF", Resolution.Minute).Symbol self.AddEquity("UVXY", Resolution.Minute).Symbol self.AddEquity("SPY", 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(300, 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.Schedule.On(self.DateRules.EveryDay("SPY"), self.TimeRules.AfterMarketOpen("SPY", 1), self.Trade) def Trade(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 if self.spySMA.Current.Value < self.Securities["SPY"].Price: if self.ratio.Current.Value < .923: self.SetHoldings("UVXY", .6) self.SetHoldings("TMF", 0) self.SetHoldings("TQQQ", 0) self.SetHoldings("SPY", .4) else: self.SetHoldings("UVXY", 0) self.SetHoldings("TMF", 0) self.SetHoldings("TQQQ", .8) self.SetHoldings("SPY", .2) else: if self.ratio.Current.Value < .923: self.SetHoldings("UVXY", .6) self.SetHoldings("TMF", .4) self.SetHoldings("TQQQ", 0) self.SetHoldings("SPY", 0) else: self.SetHoldings("UVXY", 0) self.SetHoldings("TMF", .2) self.SetHoldings("TQQQ", .4) ''' self.portfolio["SPY"].Invested = closevalue self.stopMarketTicket = self.StopMarketOrder("SPY", closevalue, 0.05 * self.Securities["SPY"].Close) ''' class QuandlVix(PythonQuandl): def __init__(self): self.ValueColumnName = "Close"