Very strange behaviour on this indicator ... bug ?

 
Hi,

I developed an indicator and it behaves strangely when changing the timeframe. Find below an indicator that behaves the same way.
In fact the indicator is ok in a given timeframe and while receiving live data. When changing timeframe, sometimes it continues to work properly and sometimes, the data in my buffers is not drawn where it should be. To reproduce it with the following code, just hit the timeframes buttons several times, quite fast to reproduce it quickly. The code just draws arrows and markers above and below the price curve.

Thanks a lot for your help

Vincent

#property indicator_chart_window
#property indicator_buffers 4
#property indicator_color1 DeepSkyBlue
#property indicator_color2 Gold
#property indicator_color3 Gold
#property indicator_color4 DeepSkyBlue

//---- input parameters

//---- buffers
double buffer1[];
double buffer2[];
double buffer3[];
double buffer4[];

//+------------------------------------------------------------------+


//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
{
   //---- indicators
   SetIndexStyle(0,DRAW_ARROW);
   SetIndexArrow(0,233);
   SetIndexStyle(1,DRAW_ARROW);
   SetIndexArrow(1,234);
   SetIndexStyle(2,DRAW_ARROW);
   SetIndexArrow(2,251);
   SetIndexStyle(3,DRAW_ARROW);
   SetIndexArrow(3,251);
   SetIndexBuffer(0,buffer1);
   SetIndexBuffer(1,buffer2);
   SetIndexBuffer(2,buffer3);
   SetIndexBuffer(3,buffer4);

   IndicatorDigits(4);

   //----
   
   return(0);
}

//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
{
   return(0);
}

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
{
   int limit = Bars - 1;

   buffer1[limit] = High[limit] + 0.2 / MathPow(10.0, Digits - 1);
   buffer2[limit] = Low[limit] - 0.2 / MathPow(10.0, Digits - 1);
   buffer3[limit] = 0.0;
   buffer4[limit] = 0.0;
   
   for(int i=limit-1; i>=0; i--)
   {
      buffer1[i] = High[i] + 0.4 / MathPow(10.0, Digits - 1);
      buffer2[i] = Low[i] - 0.4 / MathPow(10.0, Digits - 1);
      buffer3[i] = High[i] + 0.2 / MathPow(10.0, Digits - 1);
      buffer4[i] = Low[i] - 0.2 / MathPow(10.0, Digits - 1);
   }
      
   return(0);
}
 
I would like to add this:

It seems that it happens in the following case (maybe not only this one): sometimes, I change the timeframe, and the data begins to appear at the far left of the chart, let's say 2 or 3 bars. So I hit a key to scroll left and then I see that my indicator is wrong.
Hope this helps

Vincent
 
Please, someone can confirm a MT4 bug or my mistake ?
Thank you

Vincent
Reason: