При смене таймфрейма пропадает индикатор

 

Сделал индикатор НаклонСредней, после компиляции отражаются две линии, а после смены таймфренда, средняя исчезает
В чем может быть проблема???

//+------------------------------------------------------------------+
//|                                               Наклон средней.mq4 |
//|                                Copyright © 2006, Aleh Shynkevich |
//|                                                             None |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, Aleh Shynkevich"
#property link      "None"
 
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_color2 Aqua
//---- input parameters
extern int       Период=144;
extern int       Метод=0;
extern int       Цена=5;
extern int       СчитатьБаром/span>?=10000;
extern int       ПериодНаклона=5;
 
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexBuffer(1,ExtMapBuffer2);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
    int    counted_bars=IndicatorCounted();
//----
   int limit;
   if (counted_bars==0) limit=СчитатьБаром/span>?;
    else limit=Bars-counted_bars-1;
   for (int ind=limit;ind>=0;ind--)
    {
    double var1=iMA(NULL,0,Период,0,Метод,Цена,ind);
    double var2=iMA(NULL,0,Период,+ПериодНаклона,Метод,Цена,ind);
    double var3=(var1-var2);
    ExtMapBuffer1[ind]=var3;
    
    ExtMapBuffer2[ind]=iMAOnArray(ExtMapBuffer1,0,25,0,Метод,ind);
    }   
//----
   return(0);
  }
//+------------------------------------------------------------------+
 
Оформляйте код, не стесняйтесь. Кнопка MQL.
 
Простите, еще не разобрался в особенностях создания тем
 
Попробуйте открыть Data Window и посмотреть значения Вашего индикатора в нем. Наверняка, средняя не совсем "пропадает".
 
Проверил:
1. Сразу после компиляции окно обновляется и появляются две линии, в Окне данных 2 значения
2. после смены таймфренда - одна линия, и в окне данных второе значение пустое
3. при вставке индикатора тоже одна линия
 
//+------------------------------------------------------------------+
//|                                               Наклон средней.mq4 |
//|                                Copyright © 2006, Aleh Shynkevich |
//|                                                             None |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, Aleh Shynkevich"
#property link      "None"
//----
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Blue
#property indicator_color2 Red
//---- input parameters
extern int Период = 144;
extern int Метод = 0;
extern int Цена = 5;
extern int ПериодНаклона = 5;
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0, DRAW_LINE);
   SetIndexBuffer(0, ExtMapBuffer1);
   SetIndexStyle(1, DRAW_LINE);
   SetIndexBuffer(1, ExtMapBuffer2);
//----
   IndicatorDigits(Digits + 1);
//----
   IndicatorShortName("НаклСр (" + Период + ", " + Метод + ", " + Цена + ")");
   SetIndexLabel(0, "Main");
   SetIndexLabel(1, "Signal");   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int counted_bars = IndicatorCounted();
//----
   int limit;
   if(counted_bars == 0) 
       counted_bars++;
   limit = Bars - counted_bars;
   for(int ind = limit; ind >= 0; ind--)
       ExtMapBuffer1[ind] = iMA(NULL, 0, Период, 0, Метод, Цена, ind) - 
                            iMA(NULL, 0, Период, ПериодНаклона, Метод, Цена, ind);
   for(ind = limit; ind >= 0; ind--)
       ExtMapBuffer2[ind] = iMAOnArray(ExtMapBuffer1, 0, 25, 0, Метод, ind);
//----
   return(0);
  }
//+------------------------------------------------------------------+
 
как я понял проблема в том, что значения считал в одном цикле?
Спасибо за подсказку и код