Подскажите пожалуйста, что в коде индикатора не так?

 
//+------------------------------------------------------------------+
//| sss.mq4 |
//| Copyright © 2006, Nick Bilak, beluck[AT]gmail.com |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, Nick Bilak"
#property link "https://www.metaquotes.net/

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_color2 Aqua

extern int SignalGap = 0;

int dist=24;
double b1[];
double b2[];

int init() {
SetIndexStyle(0,DRAW_ARROW,STYLE_SOLID,1);
SetIndexStyle(1,DRAW_ARROW,STYLE_SOLID,1);
SetIndexArrow(1,233);
SetIndexArrow(0,234);
SetIndexBuffer(0,b1);
SetIndexBuffer(1,b2);
return(0);
}
int start() {
int counted_bars=IndicatorCounted();
int k,i,j,limit,hhb,llb;

if (counted_bars<0) return(-1);
if (counted_bars>0) counted_bars--;
limit=Bars-1;
if(counted_bars>=1) limit=Bars-counted_bars-1;
if (limit<0) limit=0;

for (i=limit;i>=0;i--) {
hhb = Highest(NULL,0,MODE_CLOSE,dist,i-dist/2);
llb = Lowest(NULL,0,MODE_CLOSE,dist,i-dist/2);

if (i==hhb)
b1[i]=Close[hhb]+SignalGap*Point;
if (i==llb)
b2[i]=Close[llb]-SignalGap*Point;
}
return(0);
}
 
//+------------------------------------------------------------------+
//|                                            UpDownInd_Cvinto.mq4  |
//|                Copyright © 2006, Nick Bilak, beluck[AT]gmail.com |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, Nick Bilak"
#property link "http://www.metaquotes.ru/"

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_color2 Blue
//----
extern int SignalGap = 8;
//----
int dist=24;
double b1[];
double b2[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init() 
  {
   SetIndexStyle(0, DRAW_ARROW, STYLE_SOLID, 2);
   SetIndexStyle(1, DRAW_ARROW, STYLE_SOLID, 2);
   SetIndexArrow(1, 233);
   SetIndexArrow(0, 234);
   SetIndexBuffer(0, b1);
   SetIndexBuffer(1, b2);
//---- name for DataWindow label
   SetIndexLabel(0, "UpInd");    
   SetIndexLabel(1, "DownInd"); 
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator start function                                  |
//+------------------------------------------------------------------+
int start() 
  {
   int counted_bars = IndicatorCounted();
   int k, i, j, limit, hhb, llb;
//----
   if(counted_bars < 0) 
       return(-1);
   if(counted_bars > 0) 
       counted_bars--;
   limit = Bars-1;
   if(counted_bars >= 1) 
       limit = Bars - counted_bars - 1;
   if(limit < 0) 
       limit = 0;
//----
   for(i = limit; i >= 0; i--) 
     {
       hhb = Highest(NULL, 0, MODE_CLOSE, dist, i - dist / 2);
       llb = Lowest(NULL, 0, MODE_CLOSE, dist, i - dist / 2);
       if(i == hhb)
       b1[i] = High[hhb] + SignalGap*Point;
       if(i == llb)
       b2[i] = Low[llb] - SignalGap*Point;
     }
   return(0);
  }
//+------------------------------------------------------------------+


[img]
https://c.mql5.com/mql4/forum/2006/07/updownind_cvinto.gif
[/img]

 
"MQL4: Проблема с картинками на форуме." :)

Но есть и еще один косяк : если в кокретную ветку (которая имеет конкретный ID) вставить 2 картинки с одинаковым допустимым именем (латиницей и не оченть длинно) ...
 
Покрутил я этот индикатор и так и эдак.. сразу не понял: то ли я совсем уже умом поехал, а создателю надо Нобелевскую, то ли здесь что-то не так.
Оказолось всё просто, как мыло. Нас просто обдурили!:))

Что это значит?

i-dist/2

Это значит, что на нулевом баре (т.е. на текущем) запрашиваются и обрабатываются максимальное и минимальное значения курсов на барах с отрицательным индексом.
Бар с отрицательным индексом - это тот, который справа от текущего (нулевого).
Автор этого шедевра просто напросто подглядывал в будущее!:)

Легко проверить, что индикатор показывает совсем другую картину в режиме реального времени.
Не наколитесь, Cvinto!

 
Marat, но ведь это сути не меняет....
 
Спасибо SK за разъяснение. Вот если б можно было это подправить как-то...)
Причина обращения: