| 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 |
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).Symbol
self.SetCash(10000) # Set Strategy Cash
self.SetWarmUp(40)
self.previousPrice = self.Securities[self.STOCK].Price
# let say you want a 20 period SMA, we will create a custom SMA indicator using the processed volume field
self.signed_volume_sma = SimpleMovingAverage(20)
#Plotting****************************************************************
stockPlot = Chart("Volume")
# we use bar for volume
stockPlot.AddSeries(Series("volume", SeriesType.Bar, 0))
self.AddChart(stockPlot)
def OnData(self, data):
# check if we have trade bar data, as only trade bar contains volume
if data.Bars.ContainsKey(self.STOCK):
Price = data.Bars[self.STOCK].Price
# check if the current price is higher than previous bar's price
if Price >= self.previousPrice:
# if yes we'll plot volume as positive
volume = data.Bars[self.STOCK].Volume
else:
# else, we plot volume as negative
volume = -data.Bars[self.STOCK].Volume
# we'll manually update our indicator
self.signed_volume_sma.Update(IndicatorDataPoint(self.Time, volume))
# renew this bar's price as the next bar's previous price
self.previousPrice = Price
#Plotting******************************************************************
self.Plot("Volume", "volume", volume)
self.Plot("SMA", "Volume", self.signed_volume_sma.Current.Value)