Download MetaTrader 5

How To Remove 1.#J from Strategy Tester Optimization Results

To add comments, please log in or register
Are you a real pro? Share your knowledge with millions of traders!
Marcelo Coutinho
1151
Marcelo Coutinho 2014.07.16 20:32 

Hi there !

Does any know how to remove the 1.#J symbol when Profit Factor is NULL running Custom Max Optimization Type.

I have placed my OnTester() code below but it is not working at all and picture is attached.

double OnTester()
  {
   double param=0;

   double pSTAT_PROFIT=TesterStatistics(STAT_PROFIT);
   double pSTAT_PROFIT_FACTOR=TesterStatistics(STAT_PROFIT_FACTOR);
   double pSTAT_RECOVERY_FACTOR=TesterStatistics(STAT_RECOVERY_FACTOR);
   double pSTAT_EQUITYDD_PERCENT=TesterStatistics(STAT_EQUITYDD_PERCENT);
   double pSTAT_TRADES=TesterStatistics(STAT_TRADES);

   if(pSTAT_TRADES>10)
      param=pSTAT_PROFIT*pSTAT_PROFIT_FACTOR;
   else
      param=-1;

   if(pSTAT_PROFIT<=0) param=param/100;

   if(pSTAT_PROFIT_FACTOR<=2) param=param/100;
   if(pSTAT_RECOVERY_FACTOR<=2) param=param/100;

   if(pSTAT_EQUITYDD_PERCENT<=0) param=param/100;
   if(pSTAT_EQUITYDD_PERCENT>=10) param=param/100;

   return(param);
  }

Thank you

Marcelo 

Files:
Capturar.PNG 44 kb
Dua Yong Rew
5422
Dua Yong Rew 2014.07.18 11:41  
I'm interested to know.
Marcelo Coutinho
1151
Marcelo Coutinho 2014.07.30 18:30  

As kindly informed by Malacarne, here is the answer.

   if (pSTAT_PROFIT_FACTOR==EMPTY_VALUE) param=-1;
To add comments, please log in or register