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
import numpy as np
from System.Drawing import Color
from clr import AddReference
AddReference("System")
AddReference("QuantConnect.Algorithm")
AddReference("QuantConnect.Common")
from datetime import date, timedelta, datetime, time
from System import *
from QuantConnect import *
from QuantConnect.Algorithm import *
from QuantConnect.Indicators import *
from QuantConnect.Data.Market import TradeBar
import decimal as d

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)
        
        #Plotting****************************************************************
        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 self.CurrentSlice.Bars.ContainsKey(self.Firststock):
            self.Price = data[self.Firststock].Value
            
#Plotting******************************************************************
            self.Plot("Trade Plot", "Price Close", self.Price)
            self.Plot("Trade Plot", "VWAP", self.Vwap.Current.Value)
            
            self.Plot("Try", "Difference", self.Diff.Current.Value)