Mql4 code to add to my exsiting EA to close all orders depending on profit

 
Good moring,

I'm trying to trasform my EA in a Grid system.

My EA opens sell and buy orders but I'd like to ass some code to do this:

-EX: I had some orders opened on EURUSD sell and buy. I'd like the EA close all orders when a certain level of profit is reached (suppose 1€ of profit)

Can someone help me to do this?

Thanks