Индикторы не совпадают.

 

Пожалйста помогите.

Если при визуальном тестировании советника 1.mq4 натянуть на график индикатор 3-cci-h3(прилагается), то, какзалось бы, при абсолютно одинаковых параметрах расчитываемых cci сигналы индикатора и фактические cci(объектным текстом в правом верхнем углу) не совпадают.

ПОЧЕМУ?

1.mq4:

double lasthigh,lastlow,lasthigh2=200000,lastlow2=0,lastpos=0,t[2];

int start()
{Comment("");
lasthigh=High[1];lastlow=Low[1];
if(lasthigh<lasthigh2)lasthigh2=lasthigh;
if(lastlow>lastlow2)lastlow2=lastlow;
t[0]=lasthigh2;
t[1]=lastlow2;  
string s1="lasthigh2 *** "+DoubleToStr(t[0],5);
string s2="lastlow2 *** "+DoubleToStr(t[1],5);
string str[2];
str[0]=s1;
str[1]=s2;
color col=Lime;
     for(int y=0;y<2;y++)
     {ObjectCreate("textSignal"+y,OBJ_LABEL,0,0,0,0,0);    
      ObjectSet("textSignal"+y,OBJPROP_CORNER,1);
      ObjectSet("textSignal"+y,OBJPROP_XDISTANCE,35-25);
      ObjectSet("textSignal"+y,OBJPROP_YDISTANCE,y*(20)+20+8);
      ObjectSetText("textSignal"+y,str[y],15,"Tahoma",col);
     }

}

3-cci:

#property copyright "johnfantom & KimIV"
#property link      "http://www.kimiv.ru"

#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 DodgerBlue
#property indicator_maximum 1.4
#property indicator_level1  0
#property indicator_minimum -1.2

//------- Внешние параметры индикатора -------------------------------
extern int CCI_Period_0 = 14;     // Период CCI для текущего ТФ
extern int Level_0      = 100;    // Уровень CCI для текущего ТФ
extern int TF_1         = 60;     // Количество минут первого ТФ
extern int CCI_Period_1 = 14;     // Период CCI для первого ТФ
extern int Level_1      = 100;    // Уровень CCI для первого ТФ
extern int TF_2         = 240;    // Количество минут второго ТФ
extern int CCI_Period_2 = 14;     // Период CCI для второго ТФ
extern int Level_2      = 100;    // Уровень CCI для второго ТФ
extern int NumberOfBars = 1000;  // Количество баров обсчёта (0-все)
extern int ExtBars=3; 
int per;


//------- Буферы индикатора ------------------------------------------
double buf0[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
void init() {
  IndicatorDigits(1);

  SetIndexBuffer(0, buf0);
  SetIndexLabel (0, "i-3CCI-h");
  SetIndexStyle (0, DRAW_HISTOGRAM, STYLE_SOLID, 2);
  SetIndexEmptyValue(0, 0);
}

//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
void deinit() {
  Comment("");
}

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
void start() {
  double cci0, cci1, cci2;
  int    nb1, nb2,count;
  int    LoopBegin, sh;

  count=IndicatorCounted();
  for (sh=count; sh>=0; sh--) {
    nb1=iBarShift(NULL, TF_1, Time[sh+1], False);
    nb2=iBarShift(NULL, TF_2, Time[sh+1], False);

    cci0=iCCI(NULL, 0   , CCI_Period_0, PRICE_CLOSE, sh+1);
    cci1=iCCI(NULL, TF_1, CCI_Period_1, PRICE_CLOSE, nb1);
    cci2=iCCI(NULL, TF_2, CCI_Period_2, PRICE_CLOSE, nb2);

}
}