Overall Statistics
Total Trades
717
Average Win
0.90%
Average Loss
-0.41%
Compounding Annual Return
8.008%
Drawdown
13.700%
Expectancy
0.314
Net Profit
71.510%
Sharpe Ratio
0.684
Loss Rate
59%
Win Rate
41%
Profit-Loss Ratio
2.17
Alpha
0.018
Beta
0.464
Annual Standard Deviation
0.099
Annual Variance
0.01
Information Ratio
-0.376
Tracking Error
0.106
Treynor Ratio
0.146
Total Fees
$1424.84
class VXXBreakOutAlgorithm(QCAlgorithm):

    def Initialize(self):
        '''Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.'''

        self.SetStartDate(2010, 01, 01)  #Set Start Date
        self.SetEndDate(2017, 01, 01)    #Set End Date
        self.SetCash(100000)             #Set Strategy Cash
        self.symbols = ["VXX","SPY","IWM","DIA"]
        
        for i in self.symbols:
            self.AddEquity(i, Resolution.Daily)

 
        self.ema = self.EMA("VXX", 14, Resolution.Daily)
  
        # self.PlotIndicator("VXX", True, self.__macd, self.__macd.Signal)
        # self.PlotIndicator("SPY", self.__macd.Fast, self.__macd.Slow)


    def OnData(self, data):

        # wait for our macd to fully initialize
        if not self.ema.IsReady: return
        # self.Plot("Strategy Equity", "VXX", self.Securities["VXX"].Price )
        # self.Plot("Strategy Equity", "EMA", self.ema.Current.Value)
        if self.Securities["VXX"].Price < self.ema.Current.Value:
            if self.Portfolio.Invested: return
            for symbol in self.symbols[1:]:
                self.SetHoldings(symbol, 1.0/len(self.symbols[1:]))
            
        else:
            self.Liquidate()