Login Page - Create Account

Support Board


Date/Time: Tue, 10 Mar 2026 05:26:19 +0000



Post From: Custom chart bars - how can new bar be time-aligned

[2026-01-22 11:47:35]
curious16 - Posts: 36
I have a question regarding the use of your s_CustomChartBarInterface.

After a new bar has been emitted, the custom bar generating function gets called with the flag IsFinalProcessingAfterNewOrCurrentBar set.
In this call the custom bar generating function can modify past and current bars such as setting
ChartBarInterface.GetChartBarValue(SC_LAST, ChartBarInterface.CurrentBarIndex - 1) =
ChartBarInterface.GetChartBarValue(SC_HIGH, ChartBarInterface.CurrentBarIndex - 1);

How can the starting time of the latest emitted bar be set? The function GetChartBarDateTime() is const, that is, read-only. Setting the starting time can make sense, for instance, to time-align with a fixed period grid. Example: the latest trade (first trade of new bar) is at 09:50:00.121 and the previous trade (last trade of prior bar) was at 09:49:58.712. It would be desirable to set the start of the new bar to 09:50:00 rather than to the timestamp of the first trade in the new bar. How can that be done? You do the same in your time-based bars but so far I haven't seen how this can be replicated with custom chart bars.

It would also be helpful to have access to the timestamp of the last trade of the previous bar. You have the array sc.BaseDataEndDateTime[], but it seems this is not accessible as part of s_CustomChartBarInterface.