Script that closes all orders and deactivates EA



I am aware there are scripts that can close all open orders for you, but what I am looking for is to set a timer which will enable and disable the EA at a certain time of the day and once disabled will close all orders.

Is there such a thing?