How to code a simple complex criterion max?

 
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.
 
Yousif Mohammed Faisal Al Tamimi:
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!

The article provides a detailed step-by-step guide on how to create a custom optimization criterion in MQL5.

Rather than simply hoping that someone will provide ready code/solution, it would be more valuable
 - spend time reading the article
 - understand the underlying principles, and then
 - attempt to implement the custom criterion yourself.

We can only help you if you show an attempt to try.

 
Yousif Mohammed Faisal Al Tamimi:
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!

I think you are overcomplicating it, what makes you think that you need the complex criterion? You can do what you want to with the custom criterium

Try this in fast genetic algorithm with custom criterium and look in the Results Collumn:

input int InpCount = 0;

//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---

//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---

  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---

  }

//+------------------------------------------------------------------+
//| Tester function                                                  |
//+------------------------------------------------------------------+
double OnTester()
  {
//---
   double ret = 0.0;
//---
   ret = InpCount;

//---
   return(ret);
  }
//+------------------------------------------------------------------+

Take it from here

 
I do not think there is a solution for you if you do not have access to EA source code.
Reason: