There is a block called "Once per bar" and this block can pass 1 time per bar. Put it before or after the condition and the result will be different. There is no such thing as "on close of the bar", but if you have "Once per bar" on top level, it will detect when a new bar is created, it will pass on the first tick of the new bar. In "Condition" you can always set Candle ID to 1, 2, 3... or anything else to work with the previous candles.