I am brand new to QuantConnect and I can't figure out what are the exact lines of code to consolidate Stock Ticks into Five Minute Bars. I have spent days on this and it seems I am no further advanced. However I am sure it is very simple.

So for example, a trade logic with InteractiveBrokers as a broker can check whether a condition is met at least 4 times per second ( I think they generate a tick every 250ms or 300ms). You would have this trade logic in the QuantConnect OnData.

I struggle with what lines of codes to use in the QuantConnect Initialize portion for the consolidation. Thank you kindly.