Overall Statistics |
Total Trades 5770 Average Win 0.40% Average Loss -1.55% Compounding Annual Return 51.394% Drawdown 37.400% Expectancy 0.120 Net Profit 11891.931% Sharpe Ratio 1.308 Probabilistic Sharpe Ratio 58.170% Loss Rate 11% Win Rate 89% Profit-Loss Ratio 0.26 Alpha 0.404 Beta 0.878 Annual Standard Deviation 0.399 Annual Variance 0.159 Information Ratio 1.034 Tracking Error 0.375 Treynor Ratio 0.594 Total Fees $127744.55 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.SetRiskManagement(TrailingStopRiskManagementModel(0.20)) 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"