Help! is this a bug in OnTester function?

 

Hi,

I am using OnTester function to create my own optimization criteria from some parameters. To start I decided to use Balance + PF, but the result is quite weird:

Example:

Pass = 24

Profit = 72.80, PF = 1.48

Param = Profit * PF = 72.80 * 1.48 = 107.744

ONTESTER = 107.83


I can't understand why they are differents... maybe I am becoming crazy! Anybody who can give me some light here? I have attached an screenshot where you can see what I am talking about!


Thanks in advance!

Files:
 
what exactly is the screenshot shows?
dont see anything
 

Just multiply Profit and its Profitfactor, after the decimal point the result differs.

I realized the same! But the error or the difference does not effect the order of the Tester-results - so far.

On the other hand the result is shown with 8 decimals in its column of the opti-results but as of the first decimal it seems to be wrong :(

And what happens if all the results are in between +1.0 and -1.0??

luxorlo, can you create an example where all the results are less than 1.0 ( e.g. devide by a constant bigger that max) and show the results

and compare the order the the original order of the tester-results.

 
gooly:

Just multiply Profit and its Profitfactor, after the decimal point the result differs.

I realized the same! But the error or the difference does not effect the order of the Tester-results - so far.

On the other hand the result is shown with 8 decimals in its column of the opti-results but as of the first decimal it seems to be wrong :(

And what happens if all the results are in between +1.0 and -1.0??

luxorlo, can you create an example where all the results are less than 1.0 ( e.g. devide by a constant bigger that max) and show the results

and compare the order the the original order of the tester-results.




Hi guys,

Thanks for your reply. I have tried with several test and the results are always differents, so not sure what happened here (maybe the differences could be because of the rounded values?). I believe this is a bug (I sent an email to metaquotes team... let´s see if they answer me).


are anyone using OnTester() function in MT4 or MT5?


Regards!

 
luxorlo:



Hi guys,

Thanks for your reply. I have tried with several test and the results are always differents, so not sure what happened here (maybe the differences could be because of the rounded values?). I believe this is a bug (I sent an email to metaquotes team... let´s see if they answer me).


are anyone using OnTester() function in MT4 or MT5?


Regards!


Can you show the relevant code ?
 
angevoyageur:
Can you show the relevant code ?

Well I am using this (as the Tester Stats were not yet implemented)

double  maxBalance,iniBalance, maxDD;
// OnInit
..
maxBalance = AccountBalance();
iniBalance = AccountBalance();
maxDD      = 0.0;
..

void MyTester(){ //called after every trade closed
        maxBalance = MathMax(maxBalance,AccountBalance());
        maxDD = MathMax(maxDD,maxBalance - AccountBalance());
}

double OnTester()  {
//---   
   MyTester();
   double prf = maxBalance - iniBalance;
   if ( maxDD > 0.01 )     return(prf/maxDD);
   // else - no DD GREATE!! ;)
   if (prf > 0.0)
      return(1000.0);
   else
      return(-1000.0);
}

And I realize small differences of OnTester to the result when I divide Profit / Drawdown $ from the Optimization Results myself.