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 -9.725 Tracking Error 0.027 Treynor Ratio 0 Total Fees $0.00 Estimated Strategy Capacity $0 |
import datetime TF = 15 class Consol(QCAlgorithm): sym = "SPY" def Initialize(self): self.SetStartDate(2020, 12, 1) self.SetEndDate(2020, 12, 3) self.SetCash(100000) spy = self.AddEquity(self.sym, Resolution.Minute) self.sma05_hi = self.SMA(self.sym, 5*TF, Resolution.Minute, Field.High) self.sma05_lo = self.SMA(self.sym, 5*TF, Resolution.Minute, Field.Low) Consolidator = TradeBarConsolidator(timedelta(minutes=TF)) self.SubscriptionManager.AddConsolidator("SPY", Consolidator) self.RegisterIndicator(self.sym, self.sma05_hi, Consolidator) self.RegisterIndicator(self.sym, self.sma05_lo, Consolidator) spy.SetDataNormalizationMode(DataNormalizationMode.Raw) def OnData(self, data): self.Plot("Data Chart", "Asset Low Price", data["SPY"].Low) self.Plot("Data Chart", "Asset High Price", data["SPY"].High) self.Plot("Data Chart", "MA5 Low", self.sma05_lo.Current.Value) self.Plot("Data Chart", "MA5 High", self.sma05_hi.Current.Value )