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
class UpgradedFluorescentOrangeCaterpillar(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2020, 8, 15)  # Set Start Date
        self.SetEndDate(2020, 8, 16)
        self.SetCash(100000)  # Set Strategy Cash
        
        self.symbol = self.AddEquity("QQQ").Symbol
        
        self.rolling_window = RollingWindow[TradeBar](10)
        
        consolidator = TradeBarConsolidator(30)
        consolidator.DataConsolidated += self.consolidation_handler
        self.SubscriptionManager.AddConsolidator("QQQ", consolidator)

        barCount = 10
        history = self.History(self.symbol, barCount * 30, Resolution.Minute).loc[self.symbol]
        for time, row in history.iterrows():
            tradebar = TradeBar(time, self.symbol, row.open, row.high, row.low, row.close, row.volume)
            consolidator.Update(tradebar)
            
    def consolidation_handler(self, sender, bar):
        self.rolling_window.Add(bar)
        self.Log(str(bar.EndTime - bar.Time) + " " + bar.ToString())
    
    def OnEndOfAlgorithm(self):
        df = self.PandasConverter.GetDataFrame[TradeBar](self.rolling_window)
        self.Log(df.to_string())