How to write the "custom" metrics for ranking in thw strategy tester

 
While  working on a different trading platform some years ago (BioProfit) I found out that  the best metrics to judge a system was to judge the slope of the equity curve. It should be as straiight as possible, not neccessary as steep as possible  I wrote a routine that calculated the straight line for the equity curve based on the "least square" method and then calculated the deviation the eguity curve made from this straight line. It gives a measure of the "consistency" of the method which is very important. I wonder  if it is possible to create such a method. There is a choice "custom" in the choice of metrics in the Strategy tester. Is there documentation somewhere how to develop such a routie?
 

Probably this article should help you https://www.mql5.com/en/articles/286

Creating Custom Criteria of Optimization of Expert Advisors
Creating Custom Criteria of Optimization of Expert Advisors
  • 2011.09.07
  • Dmitriy Skub
  • 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...
Reason: