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.156 Tracking Error 0.231 Treynor Ratio 0 Total Fees $0.00 Estimated Strategy Capacity $0 Lowest Capacity Asset |
from System.Drawing import Color # difference between the stock price and the vwap class VerticalTransdimensionalCoreWave(QCAlgorithm): def Initialize(self): self.SetTimeZone("America/New_York") self.SetStartDate(2021, 7, 16) self.SetEndDate(2021, 7, 20) stock = "QQQ" self.STOCK = self.AddEquity(stock, Resolution.Minute) self.SetCash(10000) # Set Strategy Cash self.SetWarmUp(100) self.Firststock = stock self.Percent = self.ROCP(self.Firststock, 1, Resolution.Minute) self.VolumeSet = self.SMA(self.Firststock, 1, Resolution.Minute, Field.Volume) self.Percent.Updated += self.UpdateVolumeSet self.stock = Identity(stock) self.Vwap = self.VWAP(self.Firststock) self.Diff = IndicatorExtensions.Minus(self.stock, self.Vwap) stockPlot = Chart("Trade Plot") stockPlot.AddSeries(Series("Price Close", SeriesType.Line, 0)) stockPlot.AddSeries(Series('Buy', SeriesType.Scatter, '$', Color.Green, ScatterMarkerSymbol.Triangle)) stockPlot.AddSeries(Series('Sell', SeriesType.Scatter, '$', Color.Red, ScatterMarkerSymbol.TriangleDown)) self.AddChart(stockPlot) def UpdateVolumeSet(self, sender, updated): if not self.Percent.IsReady: return if self.Percent.Current.Value < 0: self.VolumeSet.Update(self.Time, -1*(updated.Value)) else: self.VolumeSet.Update(self.Time, (updated.Value)) if not self.VolumeSet.IsReady: return def MAUpdated(self, sender, updated): self.MAWindow.Add(updated.Value) def OnData(self, data): if self.IsWarmingUp: return if not self.CurrentSlice.Bars.ContainsKey(self.Firststock): return price = data[self.Firststock].Value wvap = self.Vwap.Current.Value diff = float(price - wvap) self.Plot("Trade Plot", "Price Close", price) self.Plot("Trade Plot", "VWAP", wvap) self.Plot("Try", "Difference", diff)