I figured out a way, I share it here in case anyone in the future needs something similar: https://fxdreema.com/shared/qgX8pwIbe
I created a variable called "bar counter"
on init i set the bar counter to 5 (just needs to be a number higher than 2 in this case)
once per candle i add 1 to bar counter
once per position i set bar counter to 1
when bar counter is 2 -> close trade