| Overall Statistics |
|
Total Trades 186 Average Win 5.99% Average Loss -1.22% Compounding Annual Return 10.431% Drawdown 16.100% Expectancy 1.654 Net Profit 628.707% Sharpe Ratio 0.833 Probabilistic Sharpe Ratio 15.829% Loss Rate 55% Win Rate 45% Profit-Loss Ratio 4.90 Alpha 0.093 Beta -0.014 Annual Standard Deviation 0.11 Annual Variance 0.012 Information Ratio 0.123 Tracking Error 0.211 Treynor Ratio -6.559 Total Fees $6897107.59 |
class VentralParticlePrism(QCAlgorithm):
def Initialize(self):
self.SetStartDate(2000, 7, 22) # Set Start Date
self.SetEndDate(2020, 7, 22)
self.SetCash(250000000) # Set Strategy Cash
self.AddEquity("QQQ", Resolution.Daily)
self.AddEquity("TQQQ", Resolution.Daily)
self.AddEquity("UVXY", Resolution.Daily)
self.vma = self.SMA("QQQ", 365, Resolution.Daily, Field.Volume)
self.vmaSlope = MomentumPercent(12)
self.BuyThreshold = ((self.vma.Current.Value)*(-0.123))*100
self.SellThreshold = ((self.vma.Current.Value)*(-0.1))*100
self.Schedule.On(
self.DateRules.EveryDay("QQQ"),
self.TimeRules.AfterMarketOpen("QQQ", 7),
self.Derp)
#Whenever I raise the number of minutes to anything over 10,
#it buys and sells once every single trading day throughout
#the entire backtest. I don't understand this at all.
self.SetWarmup(365)
def OnData(self, data):
if self.IsWarmingUp:
return
self.vmaSlope.Update(self.Time, self.vma.Current.Value)
def Derp(self):
if self.vmaSlope.Current.Value >= self.SellThreshold:
self.Liquidate("TQQQ")
self.Liquidate("QQQ")
if self.vmaSlope.Current.Value <= self.BuyThreshold:
self.SetHoldings("TQQQ", 0)
self.SetHoldings("QQQ", 1)
self.SetHoldings("UVXY", 0)
#self.Short == False
#self.Long == True
#if self.vmaSlope.Current.Value >= self.SellThreshold:
# self.Liquidate("TQQQ")
# self.Liquidate("QQQ")
#self.Long == False
#self.Short == True
#self.market or limit order for UVXY equal to 10% of total portfolio value
#def GimmeHedge(self):
#if not self.vmaSlope.IsReady:
#return
#if self.Short == True:
#self.SetHoldings("UVXY", 0.15)