Hi folks, 

I am trying to work with Consolidated bars and I can't seem to get the event handler to fire.

Ideally I want to work with 5 minute bars and have this 5 minute data populate my indicators. I think I have my head around how to do that via initiating the indicator like so in the Initialize function. 

self.psar = ParabolicStopAndReverse('psar',0.02, 0.02, 0.12)
self.psar.Updated += self.psarUpdated
self.RegisterIndicator(self.symbol.Symbol, self.psar, timedelta(minutes=5))

# Also want to keep a history of the PSAR Values
self.rwRL10 = RollingWindow[IndicatorDataPoint](self.p['istop_lookback'])

And then I update the rolling window like so:

def psarUpdated(self, sender, updated):
        if self.psar.IsReady: 
            self.rwPsar.Add(self.psar.Current.Value)

But at the moment I cant even get the 5 minute bars to print, I actually can't get any of the consolidators to print. I've tried a few different methods, but I feel like I am missing something stupid.

My logs from the backtest:

1
|
12:17:25
:
Building Project ID: 11295116 Content Signature: eb4a969e7bf0f6694774fa5db1816931
2
|
12:17:25
:
Backtesting Project...
3
|
12:17:25
:
Build Request Successful for Project ID: 11295116 CompileID: 8ddc4445b68f0bef5142b650682b3656-eb4a969e7bf0f6694774fa5db1816931 Lean Version: 2.5.0.0.13797
4
|
12:17:44
:
Successfully sent backtest request for 'Hyper-Active Orange Badger', (Backtest Id: 7da9965baec5a45ba445735f5d19a443)
5
|
12:17:49
:
Initializing algorithm...
6
|
12:17:50
:
Launching analysis for 7da9965baec5a45ba445735f5d19a443 with LEAN Engine v2.5.0.0.13797
7
|
12:17:50
:
2022-04-14 00:00:00 >> Setup Symbol >> AUDUSD
8
|
12:17:50
:
Algorithm (7da9965baec5a45ba445735f5d19a443) Completed.
9
|
12:17:50
:
Algorithm Id:(7da9965baec5a45ba445735f5d19a443) completed in 0.30 seconds at 0k data points per second. Processing total of 22 data points.
10
|
12:17:50
:
Backtest deployed in 6.158 seconds
11
|
12:17:51
:
Backtest Cloud Upload completed ID: 7da9965baec5a45ba445735f5d19a443

 

And from the logging console:


2022-04-14 00:00:00 :	Launching analysis for 7da9965baec5a45ba445735f5d19a443 with LEAN Engine v2.5.0.0.13797
2022-04-14 00:00:00 :	2022-04-14 00:00:00 >> Setup Symbol >> AUDUSD
2022-04-15 06:00:00 :	Algorithm Id:(7da9965baec5a45ba445735f5d19a443) completed in 0.30 seconds at 0k data points per second. Processing total of 22 data points.

 

My code: 

class EnergeticSkyBlueBuffalo(QCAlgorithm):

    def Initialize(self):
        # In initialize method:
        self.SetTimeZone("Australia/Brisbane")
        self.SetStartDate(2022, 4, 14)  # Set Start Date
        self.SetEndDate(2022, 4, 15)
        self.SetCash(50000)  # Set Strategy Cash
        self.symbol = self.AddForex("AUDUSD",Resolution.Minute, Market.FXCM)
        self.Debug(f"{self.Time} >> Setup Symbol >> {self.symbol.Symbol}")
        
        self.minuteConsolidator = QuoteBarConsolidator(timedelta(minutes=5))
        self.minuteConsolidator.DataConsolidated += self.barSizeMinuteHandler
        self.SubscriptionManager.AddConsolidator(self.symbol.Symbol, self.minuteConsolidator)

        thirtyMinuteConsolidator =QuoteBarConsolidator(timedelta(minutes=30))
        thirtyMinuteConsolidator.DataConsolidated += self.ThirtyMinuteBarHandler
        self.SubscriptionManager.AddConsolidator(self.symbol.Symbol, thirtyMinuteConsolidator)

        self.Consolidate(self.symbol.Symbol, Resolution.Minute, self.MinuteAUDUSDHandler)

    def OnData(self, data: Slice):
        '''OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here.
            Arguments:
                data: Slice object keyed by symbol containing the stock data
        '''
        self.Debug(f"OnData: >> {data.Close}")
        self.Log("Additional detailed logging messages")


    def barSizeMinuteHandler(self, sender, consolidatedBar):
        self.Debug(f"{consolidatedBar.EndTime} >> barSizeMinuteHandler >> {consolidatedBar.Close}")
        self.Log(f"{consolidatedBar.EndTime} >> barSizeMinuteHandler >> {consolidatedBar.Close}")

    def ThirtyMinuteBarHandler(self, sender, bar):
        self.Debug(str(self.Time) + " " + str(bar))

    def MinuteAUDUSDHandler(self, consolidated):
        '''This is our event handler for our daily consolidated defined using the Consolidate method'''
        self.Log(f"{consolidated.EndTime} AUDUSD Daily consolidated.")