Track Trades Closed by Take Profit or Stop Loss

 
Hi everyone, I am a beginner in Mql4 programming. I am creating an EA that can track closed trades based on Stop loss or Take profit and use that information to further process the EA for the current trade session. I am thinking of doing this noting the AccountBalance() at the beginning of the trades and track changes in the account balance if it increases or reduces. But is there a better way to do this especially using OrderSelect? Please help me. I will appreciate it if you leave some codes. Thanks.
Reason: