I am attempting to predict the upcoming period's trends and timing to use in my Insights. When a bar is produced and my alpha/insight begins generating, I need to determine the next bar's period (start and end times) in order to know when the current trend will end (Insight period). As it stands I'm taking the current algorithm time (occurs when bar is generated...so it's the TradeBar.EndTime essentially) and adding the bar's Period.

This causes an issue when we hit the last bar of the trading day/week. So for example if I'm on a 4H consolidator and the 16:00 bar completes and triggers the insight, the insight's period will occur from 16:00 - 20:00 which doesn't make sense considering those aren't tradeable hours. The same issue occurs with 1D timeframes over weekends. So I can't rely on just "adding time" to the last bar generated - I need the start/end times of the next bar that will be generated in the series.