Remnove the 'close trades' block from that position and create a separate block tree for them headed by a 'for each trade' block. Then link to it the consitions to be met for the trade to close and finally the 'close trades' block.
Please separate the launching structure from the closing one. That will avoid future problems. Additionally, please choose candle ID 1 in all 'condition' blocks.