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 0 Tracking Error 0 Treynor Ratio 0 Total Fees $0.00 Estimated Strategy Capacity $0 Lowest Capacity Asset |
# region imports from AlgorithmImports import * # endregion class CryingYellowJaguar(QCAlgorithm): def Initialize(self): self.SetStartDate(2022, 7, 3) # Set Start Date self.SetEndDate(2022, 7, 4) self.SetCash(100000) # Set Strategy Cash pair = "US30USD" self.pair = self.AddCfd(pair, Resolution.Second, Market.Oanda).Symbol #Custom Weekly Consolidator w = QuoteBarConsolidator(self.CustomWeeklyConsolidator) w.DataConsolidated += self.OnDataCustomWeekly #History Call history = self.History(self.pair, timedelta(21), Resolution.Daily) #history call for three weeks for index, row in history.iterrows(): #create bars from returned dataframe quote_bar = QuoteBar(index[1] - timedelta(1), self.pair, Bar(row.bidopen, row.bidhigh, row.bidlow, row.bidclose), 0.0, Bar(row.askopen, row.askhigh, row.asklow, row.askclose), 0.0, timedelta(1)) self.Log(quote_bar.EndTime) w.Update(quote_bar) def OnData(self, data): pass def OnDataCustomWeekly(self, sender, dataCustomDayStart): self.Log("Weekly Hello") def CustomWeeklyConsolidator(self, dt: datetime) -> CalendarInfo: #Custom Weekly On Futures / Forex Time 17h start #From https://www.quantconnect.com/docs/v2/writing-algorithms/consolidating-data/consolidator-types#02-Time-Period-Consolidators period = timedelta(7) dt = dt.replace(hour=17, minute=0, second=0, microsecond=0) delta = 1+dt.weekday() if delta > 6: delta = 0 start = dt-timedelta(delta) return CalendarInfo(start, period)