Hi, just check one EA that has this feature then apply to what you are coding. There are a lot out there that are being shared here with this feature.
I'm a programmer but never created an EA, just a few edits here and there. I will try to start programming in a few weeks when I have more free time available.
Also what you are looking might be hard to implement, because it needs to close all trades and stop other EA's from opening new trades. If you look to apply this to an EA it's easy, and for all open trades it's easy as well but for all open trades created by EA's that can re-open new trades might be tricky.
The simple way to do this is create one EA that can be attached to any chart, function to close all open trades at a given time then you can do multiple things: (not sure if any of this work but they might give some light at the end of the tunnel)
(This is from someone who haven't tested or created anything on mql)
-execute a shutdown of your metatrader or OS
-crash your Metatrader with some sort of error on code(this will prevent new trades )
OR you can use another approach. Create one EA that closes down all trades then generates one POPUP window, then use another software that waits for that popup and then he closes the POPUP and hits the Activate EA's button on metatrader in order to deactivate EA's, then after X hours he clicks again on the Activate EA's. This strange approach works, but it's not a perfect solution.
Remember that I have no experience in MQL so i don't know what can be done with it. This might help someone who needs this to be created.