Indicator return different value when changing tester mode to visual.

 

Hello everybody,

Would you please solve this problem.  I found that the repainted indicator value (zigzag) of two tester mode have value unequally.

The zigzag's buffer of these mode have their value themself. but some value are different.

because copybuffer was at Ontester() and timeframe/symbol/time period are also equalI thought that their data should be equal whether the tester mode is visual or not. 

Thank you very much

int               handle;
double            buff_filterlow[];
double            buff_filterhi[];
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int OnInit()
  {
   handle=INVALID_HANDLE;
   ArraySetAsSeries(buff_filterlow,true);
   ArraySetAsSeries(buff_filterhi,true);
   if(handle==INVALID_HANDLE)
      if((handle=iCustom(Symbol(),PERIOD_H1,"Examples\\ZigzagColor",15,5,3))==INVALID_HANDLE)
        {
         printf("Error creating zigzag indicator");
         return(false);
        }
   return(INIT_SUCCEEDED);
  }

//+------------------------------------------------------------------+
double OnTester(void)
  {
   int bar_all=Bars(Symbol(),PERIOD_H1);
   if(CopyBuffer(handle,1,0,bar_all,buff_filterlow) !=bar_all || CopyBuffer(handle,0,0,bar_all,buff_filterhi) !=bar_all)
     {
      Print("error");
     }
   for(int i=0; i<100; i++)
     {
      Print(" i ",i," hi ",buff_filterhi[i]," low ",buff_filterlow[i]);
     }
    Print("zigzag ",buff_filterhi[1326]);


   double ret=0.0;

   return(ret);
  }


No visual



Visual mode



Files:
ZigzagColor.mq5  10 kb
Reason: