Check for current profit??

 
Hello everyone,
I'm looking for a way to let a EA. Check what the total current profit is of all open orders. 
If it's is equal to for example 20 usd that it automatically closes all the orders. 
Regards, 
 
AccountProfit()
Reason: