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
-8.056
Tracking Error
0.066
Treynor Ratio
0
Total Fees
$0.00
# Donchian Channel indicator


class DonchianChannel(QCAlgorithm):
    
    def Initialize(self):    

        self.SetStartDate(2021, 2, 2)
        self.SetEndDate(2021, 2, 19)
        self.cap = 100000
        self.SetCash(self.cap)

        self.stock = self.AddEquity('QQQ', Resolution.Hour).Symbol 
        self.PERIOD = 10;
        self.SetWarmUp(self.PERIOD + 1)
        self.donchian = self.DCH(self.stock, self.PERIOD, self.PERIOD, Resolution.Hour)

        
    def OnData(self, data):
        if self.IsWarmingUp or not self.donchian.IsReady: return
        
        price = float(self.Securities[self.stock].Price)
        ub = self.donchian.UpperBand.Current.Value
        lb = self.donchian.LowerBand.Current.Value
        
        self.Plot('Indicator', 'price', price)
        self.Plot('Indicator', 'ub', ub)
        self.Plot('Indicator', 'lb', lb)
        
        self.Log(lb )
        self.Log(ub )