глюк терминала или...?

 

Всем привет! код взят из справки. обычный индикатор. проблема в том, что Print в OnCalculate выводиться два раза, а должен 1 раз. В чем прикол?

#property indicator_separate_window 
#property indicator_buffers 1 
#property indicator_plots   1 
//---- plot Label1 
#property indicator_label1  "Label1" 
#property indicator_type1   DRAW_LINE 
#property indicator_color1  clrRed 
#property indicator_style1  STYLE_SOLID 
#property indicator_width1  1 
//--- input parameters 
input int MA_Period=21; 
input int MA_Shift=0; 
input ENUM_MA_METHOD MA_Method=MODE_SMA; 
//--- indicator buffers 
double         Label1Buffer[]; 
//--- хэндл пользовательского индикатора Custom Moving Average.mq5 
int MA_handle; 
//+------------------------------------------------------------------+ 
//| Custom indicator initialization function                         | 
//+------------------------------------------------------------------+ 
int OnInit() 
  { 
//--- indicator buffers mapping 
   SetIndexBuffer(0,Label1Buffer,INDICATOR_DATA); 
   ResetLastError(); 
   MA_handle=iCustom(NULL,0,"Examples\\Custom Moving Average", 
                     MA_Period, 
                     MA_Shift, 
                     MA_Method, 
                     PRICE_CLOSE // считаем по ценам закрытия 
                     ); 
   Print("MA_handle = ",MA_handle,"  error = ",GetLastError()); 
//--- 
   return(INIT_SUCCEEDED); 
  } 
//+------------------------------------------------------------------+ 
//| Custom indicator iteration function                              | 
//+------------------------------------------------------------------+ 
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[]) 
  { 
//--- скопируем значения индикатора Custom Moving Average в наш индикаторный буфер 
   int copy=CopyBuffer(MA_handle,0,0,rates_total,Label1Buffer); 
   Print("copy =",copy,"    rates_total =",rates_total); 
//--- если попытка неудачная - сообщим об этом 
   if(copy<=0) 
      Print("Неудачная попытка получить значения индикатора Custom Moving Average"); 
//--- return value of prev_calculated for next call 
   return(rates_total); 
  } 
//+------------------------------------------------------------------+