Download MetaTrader 5

Custom analysis via ontester not working properly on mt4

To add comments, please log in or register
Maurizio Maggini
355
Maurizio Maggini  

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
19835
Stanislav Korotky  
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
355
Maurizio Maggini  
Thanks :) Only one ontester "item" can be shown?
Stanislav Korotky
19835
Stanislav Korotky  
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
355
Maurizio Maggini  
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
19835
Stanislav Korotky  
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
3352
GBWT094114  
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