Overall Statistics |
Total Trades 482 Average Win 0.02% Average Loss -0.01% Compounding Annual Return -0.853% Drawdown 11.500% Expectancy -0.534 Net Profit -1.136% Sharpe Ratio -0.022 Probabilistic Sharpe Ratio 11.923% Loss Rate 80% Win Rate 20% Profit-Loss Ratio 1.36 Alpha 0.057 Beta -0.377 Annual Standard Deviation 0.111 Annual Variance 0.012 Information Ratio -0.406 Tracking Error 0.394 Treynor Ratio 0.006 Total Fees $482.00 |
# these imports are no longer needed # from clr import AddReference # AddReference("System") # AddReference("QuantConnect.Algorithm") # AddReference("QuantConnect.Common") # AddReference("QuantConnect.Indicators") from System import * from QuantConnect import * from System.Linq import * from QuantConnect.Indicators import * from QuantConnect.Data.Market import * from System.Collections.Concurrent import * from QuantConnect.Data.UniverseSelection import * from QuantConnect.Indicators.CandlestickPatterns import * from QuantConnect.Data.Consolidators import * from datetime import timedelta, datetime import numpy as np import sys import decimal class fifteenmincandle ( QCAlgorithm): def Initialize(self): self.Debug("step2") self.SetCash(1000000) self.SetStartDate(2008,1,22) self.SetEndDate(2020,5,23) self.UniverseSettings.Resolution = Resolution.Minute equity = self.AddEquity("SPY", Resolution.Minute) self.spy = equity.Symbol periods = decimal.Decimal(1) # self.pattern = self.CandlestickPatterns.Harami(self.spy) self.SetWarmUp(timedelta(minutes=1)) self.current=self.SetStartDate(2019,1,22) #self.Consolidate("SPY", timedelta(minutes=15)) #,self.OnDataConsolidated #fifteenMinuteConsolidator.DataConsolidated += self.fifteenMinuteBarHandler self.SetTimeZone("America/New_York") #self.Schedule.On(self.Dat) #self.Schedule.On(self.DateRules.EveryDay('SPY'), self.TimeRules.BeforeMarketClose('SPY', 15), self.BuySpy) thirtyMinuteConsolidator = TradeBarConsolidator(timedelta(minutes=15)) def OnData(self,data): #self.Log("Time: {}" . format(slice.Time) ) #self.Debug("On Data start") self.Debug("h" + str(self.Time.hour)) self.Debug("M" + str(self.Time.minute)) if (self.IsWarmingUp): return #self.Debug(self.spy.Close) if self.Time.hour == 9 and self.Time.minute == 45: if data["SPY"].Close>data["SPY"].Open: self.MarketOrder("SPY", 10) # self.Beforeendofday(self.MarketOrder("SPY", -1)) # change 3 to 15 (military time) if self.Time.hour == 15 and self.Time.minute == 45: # possibly use self.Liquidate('SPY') instead? self.MarketOrder("SPY", -10) # def OnDataConsolidated(self, bar): # if bar.Time.hour == 9 and bar.Time.minute == 30: # self.openingBar = bar