To "detect" a new bar, just place the block "Once per bar" at the top of your project and connect the rest to it. With this configuration, the EA will be executed at the first tick of a new bar and you can check what you need for the previous bars like the "Candle close" with ID = 1 that is what you are asking.
0_1546626773038_33c70ac2-1c17-40bc-ae96-11ddb69061c4-image.png
https://fxdreema.com/examples#Tips-and Tricks
Once per bar -> if trade -> Close (or similar)