Neither server, nor forex connect API has this information.
Actually, here is two parts in that task:
1) You must know the borders of the candle you are watching for. It's pretty easy for H1 and shorter candle and a bit harder for H2+ candles (since it involves the offset of the trading day) and even more complex for W1+ candles, but I can publish this algo in C++ or C#.
2) You must know the server time. This is the problem. If the client computer is synchronized via network time services and it's clock are good enough - the local time can be used. Unfortunately, clocks on the most computers shows rather weather on Mars rather than the correct time . Trading Station uses pretty tricky and complex algorithm to have it's internal clock synchronized with the server. I don't think that it's a good idea to put such big workaround for inconsistency of the local clocks into the trading API.
What can be done? Developer can go the following way:
We know that:
1) Ticks comes often enough. If there is not ticks, there is no reason to trade.
2) Tick comes not later than in 500-750 ms after it actually appears.
So, the application must:
1) provide the fastest procedure to process ForexConnect messages. All trading logic must be isolated into the separate threads, the information from messages parsing must be sent to these threads via events/blocking queue.
2) Check the difference between the local clock and the tick time and if the difference is bigger than 1 second - keep the correction value in mind.
3) When (actually - on timer) the application need to check whether the candle is finished - it must add/subtract this correction value to the local clock to get the proper server time.
I think that such API may be very useful for many developers. I cannot promise that I personally can be actively involved into such API development, but I can open any sources related I already have or developed before. If here is anyone who would like to try, please let me know.