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
Tracking Error
0
Treynor Ratio
0
Total Fees
$0.00
Estimated Strategy Capacity
$0
Lowest Capacity Asset
# Volume Weighted Average Price with Standard Deviation Bands

# -------------------------
STOCK = "QQQ"; PERIOD = 30; 
# -------------------------

class DonchianChannelConsolidated(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2022, 4, 12)
        self.SetEndDate(2022, 4, 12)
        self.SetCash(100000)
        res = Resolution.Minute
        self.stock = self.AddEquity(STOCK, res).Symbol
        self.vwap = self.VWAP(self.stock, PERIOD, res)
        self.std = self.STD(self.stock, PERIOD, res)
        self.SetWarmUp(2*PERIOD, res)


    def OnData(self, data):
        if self.IsWarmingUp or not self.std.IsReady: return
    
        price =  self.Securities[self.stock].Price
        vwap = self.vwap.Current.Value
        std = self.std.Current.Value
        ub1 = vwap + std 
        ub2 = vwap + 2*std
        lb1 = vwap - std 
        lb2 = vwap - 2*std 
        
        self.Plot(STOCK, 'price', price)
        self.Plot(STOCK, 'vwap', vwap)
        self.Plot(STOCK, 'ub2', ub2)
        self.Plot(STOCK, 'ub1', ub1)
        self.Plot(STOCK, 'lb1', lb1)
        self.Plot(STOCK, 'lb2', lb2)