Script to insert in EA for close all the orders opened depending on account balance

 
Hi,

I have an EA that do a lot of orders. I'd like to close all if I reach the daily target (suppose 1%).

So if I have a balance of 1000usd the day 1 and it grow until 1020 with an equity of 1010 it must close all orders.

Could someone help me please?

Thanks a lot
Reason: