If you want to optimize your Expert Advisor using your own characteristics, you can use "Custom max" mode via OnTester() function.
This code provides you many characteristics, which can be used during the optimization of your EA. Also it allows you to save the optimized charateristics in HTML file. To define the custom optimization parameter, sometimes it's necceary to calculate many trade characteristics.
This code provides you the following characteristics:
Compared with previous version, I added the option to save optimization results (and all characteristics) to the HTML file.