I am not sure what you mean by the real close and the use of two timestamps for that, the bar has a single close and end time. The BarsType being used calculates the bar times based on the given data for that range of time. The real close of a 1 minute bar would be a single time in 1 minute intervals or 2:11:00 as an example, we shouldn't see seconds being used there.
If you want to plan a time before a projected time you need to first know what the projected time of that bar would be based on the given current timestamps.
Using 1 minute as the example, both in realtime:
If the Time[0] of the last Closed bar (OnBarClose) was 9:00:00 am and we wanted to know 10 seconds before the next bar close of 9:01:00 which would be 9:00:50 then you would have to add 1 minute to the last closed bars time 9:00:00 and then subtract 10 seconds from that value. The new value has no relation to the OnBarClose bar times and would be difficult to use in any meaningful way, you could have just used a time with 1 minute granularity without doing any other math because the seconds wont be used.
If you are using 1 minute bars and OnEachTick in realtime you could see times which are within the 1 minute bar because that is in realtime building that bar. You could for example see 10 seconds before a bar closes but you need to calculate ahead of time what the bars end time.
Comment