How to code a costume max criterion that divide Profit over Drawdown

 

Whenever I backtest, I look for the result with the higher (Profit / max drawdown) ratio. But in the optimization results tab there is no such a criterion, so after every backtest, I export the result as a spreadsheet and do the calculations there.

I'm backtesting on a free EA, so I don't have access to the original code of the EA, but I believe I can make a (.mqh include) code to use as a custom max criterion, like the balanceslope.mqh in https://www.mql5.com/en/articles/286

Could anyone guide me over an article or help me write this code?

Thanks alot in advance!

Creating Custom Criteria of Optimization of Expert Advisors
Creating Custom Criteria of Optimization of Expert Advisors
  • www.mql5.com
The MetaTrader 5 Client Terminal offers a wide range of opportunities for optimization of Expert Advisor parameters. In addition to the optimization criteria included in the strategy tester, developers are given the opportunity of creating their own criteria. This leads to an almost limitless number of possibilities of testing and optimizing of Expert Advisors. The article describes practical ways of creating such criteria - both complex and simple ones.