The problem is that you don't exactly know when is the end of each candle. The end is where the last tick is. If you can try something with "Hours filter", "Minutes filter", "Seconds filter" or similar blocks, if you want to do something somewhere at the end of the candle. But again, you can never be sure that the final tick will come at the last second. And this is more true for the Tester where the ticks are generated and their time is stupid.
If you want to do something at the last second every time, then go to "on Timer" (set it up in the project's settings). But this can't be backtested correctly, because again - all ticks are generated with some fake times.