There are a few ways of doing this. You could export the trade history into a 3rd party application (MS excel or access) and handle the analysis from there. There are quite a few scripts on the trading forums that do this.
There's also a commerial app that analyses trades by scraping values from the HTML account history report that MT creates (IIRC you'll need the paid for version if you want to split EA's by magic number but theres a demo version that kind of illustrates how it might just work)
Forex Analysis Software, Metatrader and Oanda Analysis, Oanda Export/Import - Forex Control Center
You might also want to look at the indicator on the link below, OK if you just want a quick analysis without messing around downloading stuff
Closed Trade History EA / Indicator - Forex Trading