| Overall Statistics |
|
Total Trades 256 Average Win 1.79% Average Loss -1.58% Compounding Annual Return 8.457% Drawdown 21.000% Expectancy 0.232 Net Profit 55.253% Sharpe Ratio 0.688 Probabilistic Sharpe Ratio 16.721% Loss Rate 42% Win Rate 58% Profit-Loss Ratio 1.13 Alpha 0.064 Beta -0.015 Annual Standard Deviation 0.09 Annual Variance 0.008 Information Ratio -0.243 Tracking Error 0.186 Treynor Ratio -4.119 Total Fees $1092.88 Estimated Strategy Capacity $51000000.00 Lowest Capacity Asset TSLA UNU3P8Y3WFAD |
# Fading The Normalized Gap
# https://www.quantconnect.com/project/11953395
# --------------------------------
STOCK = "TSLA"; THRESHOLD = -0.02;
# --------------------------------
class FadingTheGap(QCAlgorithm):
def Initialize(self):
self.SetStartDate(2017, 1, 1)
self.SetEndDate(2022, 6, 1)
self.SetCash(100000)
self.stock = self.AddEquity(STOCK, Resolution.Minute).Symbol
self.Schedule.On(self.DateRules.EveryDay(), self.TimeRules.BeforeMarketClose(self.stock, 0), self.ClosingBar)
self.Schedule.On(self.DateRules.EveryDay(), self.TimeRules.AfterMarketOpen(self.stock, 1), self.OpeningBar)
self.Schedule.On(self.DateRules.EveryDay(), self.TimeRules.AfterMarketOpen(self.stock, 45), self.ClosePositions)
self.window = RollingWindow[TradeBar](2)
def ClosingBar(self):
self.window.Add(self.CurrentSlice[self.stock])
def OpeningBar(self):
if self.stock in self.CurrentSlice.Bars:
self.window.Add(self.CurrentSlice[self.stock])
if not self.window.IsReady: return
norm_delta = self.window[0].Open / self.window[1].Close - 1
if norm_delta < THRESHOLD:
self.SetHoldings(self.stock, 1)
def ClosePositions(self):
self.Liquidate()