Overall Statistics |
Total Trades 721 Average Win 0.74% Average Loss -0.64% Compounding Annual Return -76.793% Drawdown 31.200% Expectancy -0.067 Net Profit -16.480% Sharpe Ratio -1.051 Probabilistic Sharpe Ratio 15.030% Loss Rate 57% Win Rate 43% Profit-Loss Ratio 1.15 Alpha -0.672 Beta 2.335 Annual Standard Deviation 0.686 Annual Variance 0.471 Information Ratio -1.283 Tracking Error 0.546 Treynor Ratio -0.309 Total Fees $721.00 |
class VerticalTransdimensionalCoreWave(QCAlgorithm): def Initialize(self): self.SetStartDate(2020,8,24) self.SetEndDate(2020, 10,5) self.TQQQ = self.AddEquity("TQQQ", Resolution.Minute) self.SetCash(10000) # Set Strategy Cash self.SetWarmUp(200) self.Firststock = "TQQQ" #Indicators that can be changed self.FirstHMAPeriod = 25 #self.FirstBuyIndicator = self.GetParameter("FirstBuyIndicator") #self.FirstSellIndicator = self.GetParameter("FirstSellIndicator") self.ShortEMA = 25 self.LongEMA = 50 self.CyclePeriod = 10 self.Firsthma = self.HMA(self.Firststock, self.FirstHMAPeriod, Resolution.Minute) #Initializing the Hull Moving Average of the First Stock self.FirstSchaff = self.STC(self.Firststock, self.CyclePeriod, self.ShortEMA, self.LongEMA, MovingAverageType.Exponential) #Initializing the Schaff Trend Cycle Indicator on the First Stock self.FirstSchaff.Updated += self.SchaffUpdated self.SchaffWindow = RollingWindow[float](3) self.window = RollingWindow[float](2) #Plotting**************************************************************** stockPlot = Chart("Trade Plot") stockPlot.AddSeries(Series("Price", SeriesType.Line, 0)) stockPlot.AddSeries(Series("Buy", SeriesType.Scatter, 0)) stockPlot.AddSeries(Series("Sell", SeriesType.Scatter, 0)) stockPlot.AddSeries(Series("FirstHMA", SeriesType.Line, 0)) self.AddChart(stockPlot) def SchaffUpdated(self, sender, updated): self.SchaffWindow.Add(updated.Value) def OnData(self, data): #Where actions take place and you enter in the criteria to follow if self.IsWarmingUp: return #warming up the data, starts running the algorithm before the actual start data self.window.Add(self.CurrentSlice.Bars[self.Firststock].Close) if not (self.SchaffWindow.IsReady and self.window.IsReady): return one = self.SchaffWindow[0] two = self.SchaffWindow[1] #First Stock Buy Action Area if self.SchaffWindow[0] > 25 and self.SchaffWindow[1]< 25: if (not self.Portfolio.Invested): self.SetHoldings(self.Firststock, 1, True) self.Plot("Trade Plot", "Buy", data[self.Firststock].Value) #First Stock Sell Action Area if self.SchaffWindow[0] < 75 and self.SchaffWindow[1] > 75: if (self.Portfolio.Invested): self.Liquidate(self.Firststock) self.Plot("Trade Plot", "Sell", data[self.Firststock].Value) #Plotting****************************************************************** self.Plot("Trade Plot", "Price", data[self.Firststock].Close) self.Plot("Trade Plot", "FirstHMA", self.Firsthma.Current.Value) self.Plot("Indicator", "FirstSchaff", self.FirstSchaff.Current.Value)