Download MetaTrader 5

Custom analysis via ontester not working properly on mt4

To add comments, please log in or register
Maurizio Maggini
302
Maurizio Maggini 2016.08.17 12:52 

Why the ontester() function of mt4 is not working properly?


I wrote this piece of very simple code that should give me an interesting way of evaluating a system.

I used the genetic algorithm (by the way what's the difference between using it and not using it?) and started an optimization.

I receive wrong results as you can see in the attached image:


The ontester should return the result of Profit/Drawdown in $. As you can see the results of that image are all wrong. For instance the first one should give a result of 7.22: 1233.98/170.93=7.22 while it returns of 4113.27!?!
And all other results are wrong too... :(
At the beginning I used the very simple version of this function: profit/max_dd and the results were all wrong anyway.

The code I used for the ontester() is this:

double OnTester()
{
  double  profit = TesterStatistics(STAT_PROFIT);
  double  max_dd = TesterStatistics(STAT_BALANCE_DD);
  double  totaltrades = TesterStatistics(STAT_TRADES);
  double  rec_factor=0.0;
  if (max_dd!=0.0) rec_factor = profit/max_dd;
  if (totaltrades<15) rec_factor=0;

  return(NormalizeDouble(rec_factor,2));
}


Stanislav Korotky
18212
Stanislav Korotky 2016.08.17 16:36  
First thing to check is to change DD in your code (should be STAT_EQUITY_DD), because the tester shows you DD on equity.
Maurizio Maggini
302
Maurizio Maggini 2016.08.17 18:01  
Thanks :) Only one ontester "item" can be shown?
Stanislav Korotky
18212
Stanislav Korotky 2016.08.17 20:29  
Maurizio Maggini:
Thanks :) Only one ontester "item" can be shown?
You can provide only one value per pass. I'm not sure how would you optimize on many. Hence only one is shown (on a single row).
Maurizio Maggini
302
Maurizio Maggini 2016.08.18 12:34  
Stanislav Korotky:
You can provide only one value per pass. I'm not sure how would you optimize on many. Hence only one is shown (on a single row).

I meant that I would like to see on the optimization results tab 2 or more custom analysis like the recovery factor and the % of winners or something like that. It would be nice to have that ability to do that as you can do it on other software like amibroker.

Stanislav Korotky
18212
Stanislav Korotky 2016.08.19 10:56  
Maurizio Maggini:

I meant that I would like to see on the optimization results tab 2 or more custom analysis like the recovery factor and the % of winners or something like that. It would be nice to have that ability to do that as you can do it on other software like amibroker.

You can write your sugesstion to the service desk.
GBWT094114
3342
GBWT094114 2016.10.23 16:13  
How you don't get bored with this old fashion optimization process, you need to move to real time data mining style of expert advisors, which are the only ones that may give you better understanding of serious algorithmic trading. 
To add comments, please log in or register