Overall Statistics |
Total Trades 1203 Average Win 0% Average Loss 0% Compounding Annual Return 8.559% Drawdown 47.900% Expectancy 0 Net Profit 133.748% Sharpe Ratio 0.549 Probabilistic Sharpe Ratio 6.473% Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha -0.026 Beta 0.941 Annual Standard Deviation 0.194 Annual Variance 0.038 Information Ratio -0.323 Tracking Error 0.105 Treynor Ratio 0.113 Total Fees $1203.00 |
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(100000) 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(2010,1,22) #self.Consolidate("SPY", timedelta(minutes=15)) #,self.OnDataConsolidated #fifteenMinuteConsolidator.DataConsolidated += self.fifteenMinuteBarHandler self.SetTimeZone("America/New_York") thirtyMinuteConsolidator = TradeBarConsolidator(timedelta(minutes=15)) def OnData(self,data): #self.Log("Time: {}" . format(slice.Time) ) #self.Debug("On Data start") 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", 1) # self.Beforeendofday(self.MarketOrder("SPY", -1)) if self.Time.hour == 3 and self.Time.minute == 45: self.MarketOrder("SPY", -1) # def OnDataConsolidated(self, bar): # if bar.Time.hour == 9 and bar.Time.minute == 30: # self.openingBar = bar