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
-2.237
Tracking Error
0.13
Treynor Ratio
0
Total Fees
$0.00
Estimated Strategy Capacity
$0
# Standard Deviation Bands of EMA

class StandardDeviationBands_of_EMA(QCAlgorithm):
    
    def Initialize(self):
        
        self.SetStartDate(2021, 1, 1)  
        self.SetEndDate(2021, 5, 11) 
        self.SetCash(100000)
        res = Resolution.Daily
        self.stock = self.AddEquity('SPY', res).Symbol
        period = 21
        self.SetWarmUp(period * 5)
        
        self.price = self.Identity(self.stock)
        self.ema = self.EMA(self.stock, period, res)
        self.std = self.STD(self.stock, period, res)
        self.ema_std = IndicatorExtensions.Of(self.std, self.ema)


    def OnData(self, data):
        if self.IsWarmingUp or  not (self.ema.IsReady and self.ema_std.IsReady): 
            return 
        
        self.Plot('STD BANDS OF EMA', 'ema', self.ema.Current.Value)        
        self.Plot('STD BANDS OF EMA', 'upper band', self.ema.Current.Value + self.ema_std.Current.Value) 
        self.Plot('STD BANDS OF EMA', 'lower band', self.ema.Current.Value - self.ema_std.Current.Value) 
        self.Plot('STD BANDS OF EMA', 'price', self.price.Current.Value)