| Overall Statistics |
|
Total Trades 125 Average Win 3.16% Average Loss -2.09% Compounding Annual Return 19.457% Drawdown 15.000% Expectancy 0.621 Net Profit 104.394% Sharpe Ratio 0.985 Probabilistic Sharpe Ratio 42.515% Loss Rate 35% Win Rate 65% Profit-Loss Ratio 1.51 Alpha 0.079 Beta 0.489 Annual Standard Deviation 0.145 Annual Variance 0.021 Information Ratio 0.082 Tracking Error 0.147 Treynor Ratio 0.292 Total Fees $375.75 Estimated Strategy Capacity $75000000.00 Lowest Capacity Asset QQQ RIWIV7K5Z9LX |
class IndicatorTests(QCAlgorithm):
def Initialize(self):
# In addition to other initialize logic:
self.SetStartDate(2018, 1, 1)
#self.SetEndDate(2019, 1, 1)
self.SetWarmUp(14)
self.AddEquity("QQQ", Resolution.Hour)
self.vix = self.AddIndex("VIX", Resolution.Minute).Symbol
self.rsi = self.RSI("QQQ", 14, Resolution.Hour) # Creating a RSI
self.rsiSMA = IndicatorExtensions.SMA(self.rsi, 14) # Creating the SMA on the RSI
# self.dailyrsi = self.RSI("QQQ", 14, Resolution.Daily)
# self.dailyrsiSMA = IndicatorExtensions.SMA(self.dailyrsi, 14)
# thirtyMinuteConsolidator = TradeBarConsolidator(timedelta(minutes=30))
# thirtyMinuteConsolidator.DataConsolidated += self.ThirtyMinuteBarHandler
# self.SubscriptionManager.AddConsolidator("SPY", thirtyMinuteConsolidator)
def OnData(self, data):
if self.IsWarmingUp: return
self.Plot("RSI SMA", "RSI", self.rsi.Current.Value)
self.Plot("RSI SMA", "SMA of RSI", self.rsiSMA.Current.Value)
if self.rsi.Current.Value > self.rsiSMA.Current.Value and self.rsi.Current.Value < 50 and not self.Securities[self.vix].Price > 40:
self.SetHoldings("QQQ", 1)
elif self.rsi.Current.Value > 70 and self.rsi.Current.Value < self.rsiSMA.Current.Value or self.Securities[self.vix].Price > 40 :
self.Liquidate()
# self.Plot("RSI SMA", "SMA of RSI 2", self.rsiSMA2.Current.Value)
# def OnEndOfDay(self):
# if self.Portfolio["QQQ"].UnrealizedProfitPercent < -0.02:
# self.Liquidate()
# #self.AllowTrades = False