Well, at least try to do something 🙂 I'm here to help people when don't know how to do something, but at least they tried.

Hints:
Pending orders probably. There is also OCO option in these blocks.
Once per bar -> Close positions