Overall Statistics |
Total Trades 0 Average Win 0% Average Loss 0% Compounding Annual Return 0% Drawdown 0% Expectancy 0 Net Profit 0% Sharpe Ratio 0 Probabilistic Sharpe Ratio 0% Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha 0 Beta 0 Annual Standard Deviation 0 Annual Variance 0 Information Ratio 0.097 Tracking Error 0.217 Treynor Ratio 0 Total Fees $0.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[IndicatorDataPoint](3) self.window = RollingWindow[TradeBar](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) 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 if not (self.SchaffWindow.IsReady and self.window.IsReady): return self.window.Add(self.CurrentSlice.Bars[self.Firststock].Close) 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)