Overall Statistics |
Total Trades 542 Average Win 0% Average Loss -0.01% Compounding Annual Return -67.500% Drawdown 9.600% Expectancy -1 Net Profit -8.730% Sharpe Ratio -3.548 Probabilistic Sharpe Ratio 3.123% Loss Rate 100% Win Rate 0% Profit-Loss Ratio 0 Alpha 0.659 Beta -0.968 Annual Standard Deviation 0.191 Annual Variance 0.037 Information Ratio -5.498 Tracking Error 0.374 Treynor Ratio 0.7 Total Fees $543.03 |
class WarmupAlgorithm(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.''' # Select ticker and amount of contracts self.ticker = "SPY" self.contracts = 100 self.SetStartDate(2019,1,1) #Set Start Date self.SetEndDate(2019,1,30) #Set End Date self.SetCash(100000) #Set Strategy Cash # Find more symbols here: http://quantconnect.com/data spy = self.AddEquity(self.ticker, Resolution.Minute) spy.SetDataNormalizationMode(DataNormalizationMode.Raw) # MA Periods fast_period = 50 slow_period = 200 self.fast = self.EMA(self.ticker, fast_period, Resolution.Daily) self.slow = self.EMA(self.ticker, slow_period, Resolution.Daily) # Set the warm up period to the length of the slow period MA self.SetWarmup(slow_period, Resolution.Daily) def OnData(self, data): # Warmup starts as True and once Warmup is complete goes to false which lets the algo run if self.IsWarmingUp: return # Plot the values of the various indicators self.Plot("EMAfast", "Value", self.fast.Current.Value) self.Plot("EMAslow", "Value", self.slow.Current.Value) if self.fast.Current.Value > self.slow.Current.Value: self.SetHoldings(self.ticker, 1) else: self.SetHoldings(self.ticker, -1)