mt5 is crazy or it's a new function

 
//+------------------------------------------------------------------+
//|                                                          WPR.mq5 |
//|                   Copyright 2009-2017, MetaQuotes Software Corp. |
//|                                              http://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright   "2009-2017, MetaQuotes Software Corp."
#property link        "http://www.mql5.com"
#property description "Larry Williams' Percent Range"
//#include <Indicators\Indicator.mqh>CIndicator ind;
//---- indicator settings
#property indicator_chart_window
//#property indicator_level1     -20.0
//#property indicator_level2     -80.0
#property indicator_levelstyle STYLE_DOT
#property indicator_levelcolor Silver
#property indicator_levelwidth 1
//#property indicator_maximum    0.0
//#property indicator_minimum    -100.0
#property indicator_buffers    3
#property indicator_plots      3

#property indicator_label1     "close" 
#property indicator_type1      DRAW_LINE
#property indicator_color1     clrDodgerBlue
#property indicator_style1       STYLE_SOLID 
#property indicator_width1       2 

//#property indicator_label2     "ma" 
//#property indicator_type2      DRAW_LINE
//#property indicator_color2     clrAqua
//#property indicator_style2       STYLE_SOLID 
//#property indicator_width2       2 
//
//#property indicator_label3     "ma2" 
//#property indicator_type3      DRAW_LINE
//#property indicator_color3     clrCrimson
//#property indicator_style3       STYLE_SOLID 
//#property indicator_width3       2 
//---- input parameters
input int InpWPRPeriod=14; // Period
input int ma2=300; // Period
//---- buffers
double    bf_test[],bf_ma[],bf_macd[];
int       mahandle;
//--- global variables
int       ExtPeriodWPR;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
void OnInit()
  {
//--- check for input value
   if(InpWPRPeriod<3)
     {
      ExtPeriodWPR=14;
      Print("Incorrect InpWPRPeriod value. Indicator will use value=",ExtPeriodWPR);
     }
   else ExtPeriodWPR=InpWPRPeriod;
//---- name for DataWindow and indicator subwindow label
//IndicatorSetString(INDICATOR_SHORTNAME,"%R"+"("+string(ExtPeriodWPR)+")");
//---- indicator's buffer   
//SetIndexBuffer(0,bf_test);

   SetIndexBuffer(0,bf_test,INDICATOR_DATA);
   SetIndexBuffer(1,bf_ma,INDICATOR_DATA);
   ArraySetAsSeries(bf_test,true);

   PlotIndexSetInteger(0,PLOT_DRAW_TYPE,DRAW_ARROW);
   PlotIndexSetInteger(0,PLOT_ARROW,161);
   PlotIndexSetInteger(1,PLOT_DRAW_TYPE,DRAW_LINE);
   PlotIndexSetInteger(2,PLOT_DRAW_TYPE,DRAW_LINE);
//PlotIndexSetInteger(0,PLOT_DRAW_BEGIN,ExtPeriodWPR-1);
//--- digits   
   IndicatorSetInteger(INDICATOR_DIGITS,_Digits);

//mahandle=iMA(NULL,1,50,0,MODE_EMA,PRICE_CLOSE);
/*
   MqlParam params[]; 
   int      h_MA,h_MACD; 
//--- 创建 iMA("EURUSD",PERIOD_M15,8,0,MODE_EMA,PRICE_CLOSE); 
   ArrayResize(params,4); 
//--- 设置 ma_period 
   params[0].type         =TYPE_INT; 
   params[0].integer_value=8; 
//--- 设置 ma_shift 
   params[1].type         =TYPE_INT; 
   params[1].integer_value=0; 
//--- 设置 ma_method 
   params[2].type         =TYPE_INT; 
   params[2].integer_value=MODE_EMA; 
//--- 数组 applied_price 
   params[3].type         =TYPE_INT; 
   params[3].integer_value=PRICE_CLOSE; 
   ind.Create(NULL,0,IND_MA,4,params);
   */
//----
  }
//+------------------------------------------------------------------+
//| Williams?Percent Range                                          |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {
   CopyBuffer(mahandle,1,0,100,bf_ma);
   return(rates_total);
      MqlRates rt[];
      ArraySetAsSeries(rt,true);
      int copied=CopyRates(NULL,0,0,100,rt);
   
      for(int i=0;i<100;i++)
        {
   
         if(copied<=0)
            Print("Error copying price data ",GetLastError());
         else
            PrintFormat("i=%d,close=%.06f, time=%s"
                        ,i,rt[i].close,TimeToString(time[i],TIME_DATE|TIME_MINUTES)
                        );
   
         bf_test[i]=rt[i].open;
   
         Print("i=",i," buffer=",bf_test[i]);

     }
   ArraySetAsSeries(bf_test,true);
//--- return new prev_calculated value
   return(rates_total);
  }
  
  void OnDeinit(const int reason)
    {
     PlaySound("request");
    }
//+------------------------------------------------------------------+

As the name of this indicator, it's a test.Because my MT5 start to do things I didn't write. In my M30 chart  draw a ma line.I draw this ma line before but I don't want it now. I had comment every code about this ma line. but I still on my m30 chart. but not on other chart. MT5 is saving something like a cookie in somewhere let this chart remember this indicator before but not now. Any one can tell me how too update my chart to show the new Indicator immediately. I am new to MQL5 so I have to try to change my code frequently.  Help me please.

Reason: