EA error - page 2

 
   if(Digits == 5)
      {
         Window = Window * 10;
Don't do this, each time you switch time frames, pairs, refresh chart, etc, you go through an init/deinit cycle. Therefor window = 10, 100, 1000 ...