Custom indicator in tester mode problem

 

Hello guys.

I have an EA tha load couple custom indicators. In test mode, boths stop at exactly the same date and time. At the end of the testing if I right click and open the indicator property window and hit OK butom without changing anything, then it redraws completelly. The problem shows also in the data window no values after the date and after opening/closing the ind. prop. windows, all the values show in Data window. I then added a iCCI indicator into the EA, and this one draws completelly. So, maybe there is a problem with my iCustom indis, so I download another custom indicator from this site made by Rosh (Williams' Accumulation/Distribution) and this one also have the problem. Is it there any setting I am missing?. Here are copy of the charts before I open the indicator property windows. The main chart is a Bollingers flavor indic., the first indic window is Rosh's, the second windows is iCCI, and the third in another custom indic.

After hiting the OK butom in the property window for the Bands it redraws like here:

Any thoughts?

Thanx,

 
1121048:

Hello guys.

I have an EA tha load couple custom indicators. In test mode, boths stop at exactly the same date and time. At the end of the testing if I right click and open the indicator property window and hit OK butom without changing anything, then it redraws completelly. The problem shows also in the data window no values after the date and after opening/closing the ind. prop. windows, all the values show in Data window. I then added a iCCI indicator into the EA, and this one draws completelly. So, maybe there is a problem with my iCustom indis, so I download another custom indicator from this site made by Rosh (Williams' Accumulation/Distribution) and this one also have the problem. Is it there any setting I am missing?. Here are copy of the charts before I open the indicator property windows. The main chart is a Bollingers flavor indic., the first indic window is Rosh's, the second windows is iCCI, and the third in another custom indic.

After hiting the OK butom in the property window for the Bands it redraws like here:

Any thoughts?

Thanx,


bump
 
1121048:

bump


I just isolated the piece of code that cause this. I'm still clueless as why this is happening.

This is the function causing this:

// ------
double CalcF(double& buffer[])
{
 double bl = MathAbs(buffer[ArrayMinimum(buffer)]);
 double f[];
 ArrayResize(f,0);
 array_push(f,0);
 double TWR;
 double starting_value,prev_working_value,curr_working_value,value,twr;
 for(double startf= 0.01; startf <= 1; startf = startf + 0.01) 
 {
   starting_value = bl/startf;
   prev_working_value = bl/startf;
   for(int i = 0 ; i < ArraySize(buffer); i ++)
   {
     value = (prev_working_value/starting_value)*buffer[i];
     curr_working_value = value * prev_working_value;
     starting_value = prev_working_value;
     prev_working_value = curr_working_value;
   }
   twr = curr_working_value/starting_value;
   TWR = f[0];
   if(twr < TWR)
   {
     return(startf);
   }  
   else
   {
     ArrayResize(f,0); 
     array_push(f,twr);
   }   
 }
 return(-1);
}
And this is the calling function:
// ----------
void OptimalF(int last_ords, int prev_ords)
{ 
   int index = KeepIndex(ind);
   int i=0;
   for(int nCnt = OrdersHistoryTotal() - 1; nCnt >= 0; nCnt--)   
 {
   OrderSelect(nCnt, SELECT_BY_POS, MODE_HISTORY);
   if(OrderMagicNumber() == MagicNumber)
   {
    int s = ArraySize(Profits);
      ArrayResize(Profits,s+1);
      Profits[index] = OrderProfit();
      index ++;
     } 
   }
     for(int h=0;h<(last_ords-prev_ords);h++)
     {
      debug(2,"Profits["+h+"]="+Profits[h]);
      array_push(Pro,Profits[h]);
     } 
    CalcF(Pro); 
  
} 
This is the part inside start():
   int orders = OrdersHistoryTotal();
    int ords = KeepOrders(orders);
    if(ords != orders)   
     OptimalF(orders,ords);
 
If I comment out CalcF(Pro), then the charts draws completly. Why this happens? Do you have a clue? I need an advise how to go arround this problem. 
Thanks
Reason: