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 -33.971 Tracking Error 0.399 Treynor Ratio 0 Total Fees $0.00 Estimated Strategy Capacity $0 Lowest Capacity Asset |
from System import * from QuantConnect import * from QuantConnect.Indicators import * from QuantConnect.Data import * from QuantConnect.Data.Market import * from QuantConnect.Data.Custom import * from QuantConnect.Algorithm import * from QuantConnect.Python import * from QuantConnect import Market import pandas as pd import numpy as np import talib from collections import deque class EMACrossover(QCAlgorithm): def Initialize(self): self.SetStartDate(2020, 4, 1) # Set Start Date self.SetEndDate(2020, 4, 20) self.SetCash(10000) # Set Strategy Cash self.SetWarmUp(150) self.AddEquity("AMD", Resolution.Minute, Market.USA, True, 1, False) self.sym ="AMD" self.consolidatedwindow = RollingWindow[TradeBar](10) self.consolidator = TradeBarConsolidator(timedelta(1)) self.consolidator.DataConsolidated += self.consolidation_handler self.SubscriptionManager.AddConsolidator("AMD", self.consolidator) def consolidation_handler(self, sender, bar): self.consolidatedwindow.Add(bar) def OnData(self, data): if not all([data.Bars.ContainsKey("AMD")]): return if not (self.consolidatedwindow.IsReady): return yesterday_close = self.consolidatedwindow[0].Close today_open = self.consolidator.WorkingBar.Open self.Debug(f"at {data.Time}, yest close: {yesterday_close}; today open: {today_open}")