Help (помогите переделать индюк с мт4 на мт5)

 
Здравствуйте жители форума. Нужна ваша помощь. Если не трудно помогите подправить (изменить) индикатор из мт4 для мт5. Хочу сказать автору спасибо за данный индюк.
Вот код:
//+------------+-----------------------------------------------------+
//| v.22.04.07 |                                         ArrZZx2.mq4 |
//+------------+                                                     |
//|------------|              Bookkeeper, 2007, yuzefovich@gmail.com |
//+------------+-----------------------------------------------------+
#property copyright ""
#property link      "http://www.forexter.land.ru/indicators.htm"

//
//
//
//
//

#property indicator_chart_window
#property indicator_buffers 8
#property indicator_color1  Yellow
#property indicator_color2  RoyalBlue
#property indicator_color3  Blue
#property indicator_color4  Blue
#property indicator_color5  Blue
#property indicator_color6  Red
#property indicator_color7  Blue
#property indicator_color8  Red

//--------------------------------------------------------------------
//
//
//
//

extern int  SR              = 3;  
extern int  SRZZ            = 12; 
extern int  MainRZZ         = 20; 
extern int  FP              = 21;
extern int  SMF             = 3;  
extern bool DrawZZ          = false;
extern int  PriceConst      = 0; 

extern bool alertsOn        = false;
extern bool alertsOnCurrent = false;
extern bool alertsMessage   = true;
extern bool alertsSound     = false;
extern bool alertsNotify    = false;
extern bool alertsEmail     = false;

//--------------------------------------------------------------------
//
//
//
//

double Lmt[];
double LZZ[];
double SA[];
double SM[];
double Up[];
double Dn[];
double pUp[];
double pDn[];

//
//
//
//
//---------------------------------------------------------------------

int LTF[6] = { 0,0,0,0,0,0 };
int STF[5] = { 0,0,0,0,0 }; 
int MaxBar, nSBZZ, nLBZZ, SBZZ, LBZZ;
bool First=true;
int prevBars=0;

//---------------------------------------------------------------------
//
//
//
//

int init()
{
   IndicatorBuffers(8);
   SetIndexBuffer(0,Lmt); SetIndexStyle(0,DRAW_ARROW,EMPTY,2); SetIndexArrow(0,251); SetIndexEmptyValue(0,0.0);
   SetIndexBuffer(1,LZZ);
   
   
   SetIndexBuffer(2,SA);  SetIndexStyle(2,DRAW_NONE);
   SetIndexBuffer(3,SM);  SetIndexStyle(3,DRAW_NONE);
   SetIndexBuffer(4,Up);  SetIndexStyle(4,DRAW_ARROW,EMPTY,1); SetIndexArrow(4,233); SetIndexEmptyValue(4,0.0); SetIndexLabel(4,"trend UP");
   SetIndexBuffer(5,Dn);  SetIndexStyle(5,DRAW_ARROW,EMPTY,1); SetIndexArrow(5,234); SetIndexEmptyValue(5,0.0); SetIndexLabel(5,"trend DOWN");
   SetIndexBuffer(6,pUp); SetIndexStyle(6,DRAW_ARROW);         SetIndexArrow(6,217); SetIndexEmptyValue(6,0.0);
   SetIndexBuffer(7,pDn); SetIndexStyle(7,DRAW_ARROW);         SetIndexArrow(7,218); SetIndexEmptyValue(7,0.0);
   
   if (DrawZZ) 
   {
     SetIndexStyle(1,DRAW_SECTION,EMPTY,2); SetIndexEmptyValue(1,0.0); 
   }
   else
   {
     SetIndexStyle(1,DRAW_NONE);
   }
   
   return(0);
}

//
//
//
//
//

int deinit() { return(0); }

//
//
//
//
//

int start()
{
   int counted_bars=IndicatorCounted();
   int limit,i,j,n;

   if(counted_bars<0) return(-1);
   if(counted_bars>0) counted_bars--;

   if(First==true)
   { 
      if(SR<2) SR=2; 
      if(Bars<=2*(MainRZZ+FP+SR+2)) return(-1); 
      if(SRZZ<=SR) SRZZ=SR+1; 
         MaxBar = Bars-(MainRZZ+FP+SR+2);
         LBZZ   = MaxBar; 
         SBZZ   = LBZZ;
         prevBars=Bars;
      First=false;
   }

   //
   //
   //
   //
   //
   
   limit = MathMin(Bars-counted_bars,Bars-1);  for(i=limit;i>=0;i--) MainCalculation(i);

   if(prevBars!=Bars)
   {
         SBZZ    = Bars-nSBZZ;
         LBZZ    = Bars-nLBZZ;
         prevBars= Bars;
   } 
   SZZCalc(0);
   LZZCalc(0);
   ArrCalc();
   
   //
   //
   //
   //
   //
   
   if (alertsOn)
   {
      if (alertsOnCurrent)
         int whichBar = 0;
      else   whichBar = 1;
      
      //
      //
      //
      //
      //
      
      static string   type1 = "";
      static datetime time1 = 0;
          if (Up[whichBar]  > 0)  doAlert(type1,time1," trend changeed to UP");
          if (Dn[whichBar]  > 0)  doAlert(type1,time1," trend changeed ro DOWN");
      static string   type2 = "";
      static datetime time2 = 0;
          if (Lmt[whichBar]!= 0)  doAlert(type2,time2," Exit");
   }   
   return(0);
}

//+------------------------------------------------------------------+
//
//
//
//
//

 //+------------------------------------------------------------------+
//
//
//
//
//

void doAlert(string& previousAlert, datetime& previousTime, string doWhat)
{
   string message;
   
      if (previousAlert != doWhat || previousTime != Time[0]) {
          previousAlert  = doWhat;
          previousTime   = Time[0];

          //
          //
          //
          //
          //

          message =  StringConcatenate(Symbol()," at ",TimeToStr(TimeLocal(),TIME_SECONDS)," ArrZZx2 ",doWhat);
             if (alertsMessage) Alert(message);
             if (alertsNotify)  SendNotification(message);
             if (alertsEmail)   SendMail(StringConcatenate(Symbol()," ArrZZx2 "),message);
             if (alertsSound)   PlaySound("alert2.wav");
      }
}

//
//
//
//
//

void MainCalculation(int Pos) 
{
if((Bars-Pos)>(SR+1)) SACalc(Pos); else SA[Pos]=0; 
if((Bars-Pos)>(FP+SR+2)) SMCalc(Pos); else SM[Pos]=0; 
return; 
}

//
//
//
//
//---------------------------------------------------------------------

void SACalc(int Pos) 
{ 
int sw, i, w, ww, Shift; double sum; 

switch(PriceConst) 
{
case  0: 
  SA[Pos]=iMA(NULL,0,SR+1,0,MODE_LWMA,PRICE_CLOSE,Pos);
  break;
case  1: 
  SA[Pos]=iMA(NULL,0,SR+1,0,MODE_LWMA,PRICE_OPEN,Pos);
  break;
case  4: 
  SA[Pos]=iMA(NULL,0,SR+1,0,MODE_LWMA,PRICE_MEDIAN,Pos);
  break;
case  5: 
  SA[Pos]=iMA(NULL,0,SR+1,0,MODE_LWMA,PRICE_TYPICAL,Pos);
  break;
case  6: 
  SA[Pos]=iMA(NULL,0,SR+1,0,MODE_LWMA,PRICE_WEIGHTED,Pos);
  break;
default: 
  SA[Pos]=iMA(NULL,0,SR+1,0,MODE_LWMA,PRICE_OPEN,Pos);
  break; }
for(Shift=Pos+SR+2;Shift>Pos;Shift--) { sum=0.0; sw=0; i=0; w=Shift+SR;
ww=Shift-SR; if(ww<Pos) ww=Pos;
while(w>=Shift) {i++; sum=sum+i*SnakePrice(w); sw=sw+i; w--; }
while(w>=ww) { i--; sum=sum+i*SnakePrice(w); sw=sw+i; w--; }
SA[Shift]=sum/sw; 
} 
return; 
}

//
//
//
//
//----

double SnakePrice(int Shift) 
{
   switch(PriceConst) {
   case  0: return(Close[Shift]);
   case  1: return(Open[Shift]);
   case  4: return((High[Shift]+Low[Shift])/2);
   case  5: return((Close[Shift]+High[Shift]+Low[Shift])/3);
   case  6: return((2*Close[Shift]+High[Shift]+Low[Shift])/4);
   default: return(Open[Shift]); 
   } 
}

//
//
//
//
//---------------------------------------------------------------------

void SMCalc(int i) 
{ 
double t, b;
for(int Shift=i+SR+2;Shift>=i;Shift--) {
t=SA[ArrayMaximum(SA,FP,Shift)]; b=SA[ArrayMinimum(SA,FP,Shift)];
SM[Shift]=(2*(2+SMF)*SA[Shift]-(t+b))/2/(1+SMF); 
} 
return; 
}

//
//
//
//
//---------------------------------------------------------------------

void LZZCalc(int Pos) 
{ 
int i,RBar,LBar,ZZ,NZZ,NZig,NZag; 
i=Pos-1; NZig=0; NZag=0;
while(i<MaxBar && ZZ==0) { i++; LZZ[i]=0; RBar=i-MainRZZ; 
if(RBar<Pos) RBar=Pos; LBar=i+MainRZZ;
if(i==ArrayMinimum(SM,LBar-RBar+1,RBar)) { ZZ=-1; NZig=i; }
if(i==ArrayMaximum(SM,LBar-RBar+1,RBar)) { ZZ=1;NZag=i; } }
if(ZZ==0) return; NZZ=0;
if(i>Pos) { if(SM[i]>SM[Pos]) { if(ZZ==1) {
if(i>=Pos+MainRZZ && NZZ<5) { NZZ++; LTF[NZZ]=i; } NZag=i; 
LZZ[i]=SM[i]; } }
else { if(ZZ==-1) { if(i>=Pos+MainRZZ && NZZ<5) { NZZ++; LTF[NZZ]=i; }
NZig=i; LZZ[i]=SM[i]; } } }
while(i<LBZZ || NZZ<5) {  LZZ[i]=0; RBar=i-MainRZZ; 
if(RBar<Pos) RBar=Pos; LBar=i+MainRZZ;
if(i==ArrayMinimum(SM,LBar-RBar+1,RBar)) {
if(ZZ==-1 && SM[i]<SM[NZig]) { 
if(i>=Pos+MainRZZ && NZZ<5) LTF[NZZ]=i; LZZ[NZig]=0; LZZ[i]=SM[i]; 
NZig=i; }
if(ZZ==1) { if(i>=Pos+MainRZZ && NZZ<5) { NZZ++; LTF[NZZ]=i; } 
LZZ[i]=SM[i]; ZZ=-1; NZig=i; } }
if(i==ArrayMaximum(SM,LBar-RBar+1,RBar)) {
if(ZZ==1 && SM[i]>SM[NZag]) { 
if(i>=Pos+MainRZZ && NZZ<5) LTF[NZZ]=i; LZZ[NZag]=0; LZZ[i]=SM[i]; 
NZag=i; }
if(ZZ==-1) { if(i>=Pos+MainRZZ && NZZ<5) { NZZ++; LTF[NZZ]=i; } 
LZZ[i]=SM[i]; ZZ=1; NZag=i; } } i++; if(i>MaxBar) 
return; 
} 
nLBZZ=Bars-LTF[5]; LZZ[Pos]=SM[Pos]; 
return; 
}

//
//
//
//
//----

void SZZCalc(int Pos) 
{ 
int i,RBar,LBar,ZZ,NZZ,NZig,NZag; 
i=Pos-1; NZig=0; NZag=0;
while(i<=LBZZ && ZZ==0) { i++; pDn[i]=0; pUp[i]=0; Dn[i]=0; Up[i]=0; 
Lmt[i]=0; RBar=i-SRZZ; if(RBar<Pos) RBar=Pos; LBar=i+SRZZ;
if(i==ArrayMinimum(SM,LBar-RBar+1,RBar)) { ZZ=-1; NZig=i; }
if(i==ArrayMaximum(SM,LBar-RBar+1,RBar)) { ZZ=1; NZag=i; } }
if(ZZ==0) return; NZZ=0;
if(i>Pos) { if(SM[i]>SM[Pos]) { if(ZZ==1) {
if(i>=Pos+SRZZ && NZZ<4) { NZZ++; STF[NZZ]=i; } NZag=i; 
Dn[i-1]=Open[i-1]; } }
else { if(ZZ==-1) { if(i>=Pos+SRZZ && NZZ<4) { NZZ++; STF[NZZ]=i; }
NZig=i; Up[i-1]=Open[i-1]; } } }
while(i<=LBZZ || NZZ<4) { pDn[i]=0; pUp[i]=0; Dn[i]=0; Up[i]=0; 
Lmt[i]=0; RBar=i-SRZZ; if(RBar<Pos) RBar=Pos; LBar=i+SRZZ;
if(i==ArrayMinimum(SM,LBar-RBar+1,RBar)) {
if(ZZ==-1 && SM[i]<SM[NZig]) { 
if(i>=Pos+SRZZ && NZZ<4) STF[NZZ]=i; Up[NZig-1]=0; Up[i-1]=Open[i-1]; 
NZig=i; } if(ZZ==1) { if(i>=Pos+SRZZ && NZZ<4) { NZZ++; STF[NZZ]=i; } 
Up[i-1]=Open[i-1]; ZZ=-1; NZig=i;  } }
if(i==ArrayMaximum(SM,LBar-RBar+1,RBar)) {
if(ZZ==1 && SM[i]>SM[NZag]) { 
if(i>=Pos+SRZZ && NZZ<4) STF[NZZ]=i; Dn[NZag-1]=0; Dn[i-1]=Open[i-1]; 
NZag=i; } if(ZZ==-1) { if(i>=Pos+SRZZ && NZZ<4) { NZZ++; STF[NZZ]=i; } 
Dn[i-1]=Open[i-1]; ZZ=1; NZag=i; } } i++; if(i>LBZZ) 
return; 
} 
nSBZZ=Bars-STF[4]; 
return; 
}

//---------------------------------------------------------------------
//
//
//
//

void ArrCalc() 
{ 
int i,j,k,n,z=0; double p, b;
i=LBZZ; while(LZZ[i]==0) i--; j=i; p=LZZ[i]; i--; while(LZZ[i]==0) i--; 
if(LZZ[i]>p) z=1; if(LZZ[i]>0 && LZZ[i]<p) z=-1; p=LZZ[j]; i=j-1;  
while(i>0) { if(LZZ[i]>p) { z=-1; p=LZZ[i]; }
if(LZZ[i]>0 && LZZ[i]<p) { z=1;  p=LZZ[i]; }
if(z>0 && Dn[i]>0) { Lmt[i]=Open[i]; Dn[i]=0; }
if(z<0 && Up[i]>0) { Lmt[i]=Open[i]; Up[i]=0; }
if(z>0 && Up[i]>0) { if(i>1) { j=i-1; k=j-SRZZ+1; if(k<0) k=0; 
n=j; while(n>=k && Dn[n]==0) { pUp[n]=Up[i]; pDn[n]=0; n--; } } 
if(i==1) pUp[0]=Up[i]; } 
if(z<0 && Dn[i]>0) { if(i>1) { j=i-1; k=j-SRZZ+1; if(k<0) k=0; 
n=j; while(n>=k && Up[n]==0) { pDn[n]=Dn[i]; pUp[n]=0; n--; } } 
if(i==1) pDn[0]=Dn[i]; } 
i--; 
} 
return; 
}
Спасибо за участвие.
 
К сожалению, автор уже не может услышать/увидеть эту благодарность (((
Ушёл от нас Bookkeeper
Ушёл от нас Bookkeeper
  • 2009.03.10
  • www.mql5.com
Сообщение от Helen Друзья. Отказываюсь верить...
 
Игорь:

Начал потихоньку править сам вышеуказанный индикатор.

При компиляции ругается "'IntegerToString' - wrong parameters count    cm_ind_candle_Signal.mq5    36    58"

Я так понял снова у меня что то с массивами, я что не пойму.
   SetIndexBuffer(2, BufCol, INDICATOR_COLOR_INDEX);
   SetIndexBuffer(2, BufCol, INDICATOR_COLOR_INDEX);

?

 
Игорь:

При компиляции ругается "'IntegerToString' - wrong parameters count    cm_ind_candle_Signal.mq5    36    58"

Читаем что означает эта функция и какие параметры у нее должны быть https://www.mql5.com/ru/docs/convert/integertostring

Документация по MQL5: Преобразование данных / IntegerToString
Документация по MQL5: Преобразование данных / IntegerToString
  • www.mql5.com
[in]  Длина строки. Если длина полученной строки окажется больше указанной, то строка не усекается. Если длина полученной строки окажется меньше, то полученная строка будет дополнена слева символом-заполнителем.
 
Evgeny Belyaev:

?

Спасибо Игорь за подсказку. Кусок кода с ошибкой я удалил (по причин, что я решил следовать оригиналу вышеуказанного индикатора).
 
//+------------+-----------------------------------------------------+
//| v.1.10.20  |                                         ArrZZx2.mq5 |
//+------------+   Изменёння версия индикатора ArrZZx2.mq5 (автор    |               
//|------------| индикатора ArrZZx2.mq4 Юзефович Андрей Георгиевич)  |
//|            |                ( автор скончался)               |
//+------------+-----------------------------------------------------+
#property copyright " Изменёння версия индикатора ArrZZx2.mq4 под МТ5 "
#property link      "http://www.goga342@yandex.ru"

#property indicator_chart_window
#property indicator_buffers 8
#property indicator_plots 1
#property indicator_color1  Yellow
#property indicator_type1 DRAW_ARROW
#property indicator_color2  RoyalBlue
#property indicator_type2 DRAW_ARROW
#property indicator_color3  Blue
#property indicator_type3 DRAW_ARROW
#property indicator_color4  Blue
#property indicator_type4 DRAW_ARROW
#property indicator_color5  Blue
#property indicator_type5 DRAW_ARROW
#property indicator_color6  Red
#property indicator_type6 DRAW_ARROW
#property indicator_color7  Blue
#property indicator_type7 DRAW_ARROW
#property indicator_color8  Red
#property indicator_type8 DRAW_ARROW
//#define  SH_BUY    1// справочник mql5
//#define  SH_SELL  -1// справочник mql5
//---- indicator parameters
extern  int  SR              = 3;  
extern  int  SRZZ            = 12; 
extern  int  MainRZZ         = 20; 
extern  int  FP              = 21;
extern  int  SMF             = 3;  
extern  int  PriceConst      = 0; 
extern bool alertsOn        = false;
extern bool alertsOnCurrent = false;
extern bool alertsMessage   = true;
extern bool alertsSound     = false;
extern bool alertsNotify    = false;
extern bool alertsEmail     = false;
extern bool DrawZZ          = false;
extern bool First           = true;
//
int LTF[6] = { 0,0,0,0,0,0 };
int STF[5] = { 0,0,0,0,0 }; 
int MaxBar, nSBZZ, nLBZZ, SBZZ, LBZZ;
int prevBars=0,MainCalculation,IndicatorCounted;
int whichBar;
//---- indicator buffers
double Lmt[];
double LZZ[];
double SA[];
double SM[];
double Up[];
double Dn[];
double pUp[];
double pDn[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
void OnInit()
{
    // SetIndexBuffer(0,Lmt);SetIndexStyle(0,DRAW_ARROW,EMPTY,2);SetIndexArrow(0,251); SetIndexEmptyValue(0,0.0);
       SetIndexBuffer(0, Lmt, INDICATOR_DATA); PlotIndexSetInteger(0,PLOT_COLOR_INDEXES,2);PlotIndexSetInteger(0, PLOT_ARROW, 251);
       PlotIndexSetDouble(DRAW_NONE,PLOT_EMPTY_VALUE, EMPTY_VALUE);//Устанавливает значение пустой величины для линии индикатора.
    // SetIndexBuffer(1,LZZ);
       SetIndexBuffer(1, LZZ, INDICATOR_DATA);
    // SetIndexBuffer(2,SA);  
       SetIndexBuffer(2, SA, INDICATOR_DATA);
    // SetIndexStyle(2,DRAW_NONE);
       PlotIndexSetInteger(2,PLOT_COLOR_INDEXES,0,DRAW_NONE);
    // SetIndexBuffer(3,SM);  SetIndexStyle(3,DRAW_NONE);
       SetIndexBuffer(3,SM);PlotIndexSetInteger(3,PLOT_COLOR_INDEXES,0,DRAW_NONE);
    // SetIndexBuffer(4,Up);  SetIndexStyle(4,DRAW_ARROW,EMPTY,1); SetIndexArrow(4,233); SetIndexEmptyValue(4,0.0); SetIndexLabel(4,"trend UP");
       SetIndexBuffer(4,Up);PlotIndexSetInteger(4,PLOT_COLOR_INDEXES,1);PlotIndexSetInteger(4, PLOT_ARROW, 233);PlotIndexSetDouble(DRAW_NONE,PLOT_EMPTY_VALUE, EMPTY_VALUE);PlotIndexSetString(4,PLOT_LABEL,"trend UP");
    // SetIndexBuffer(5,Dn);  SetIndexStyle(5,DRAW_ARROW,EMPTY,1); SetIndexArrow(5,234); SetIndexEmptyValue(5,0.0); SetIndexLabel(5,"trend DOWN");
       SetIndexBuffer(5,Dn);PlotIndexSetInteger(5,PLOT_COLOR_INDEXES,1);PlotIndexSetInteger(5, PLOT_ARROW, 234);PlotIndexSetDouble(DRAW_NONE,PLOT_EMPTY_VALUE, EMPTY_VALUE);PlotIndexSetString(4,PLOT_LABEL,"trend Dn");
    // SetIndexBuffer(6,pUp); SetIndexStyle(6,DRAW_ARROW);         SetIndexArrow(6,217); SetIndexEmptyValue(6,0.0);
       SetIndexBuffer(6,pUp);PlotIndexSetInteger(6,PLOT_COLOR_INDEXES,1);PlotIndexSetInteger(6, PLOT_ARROW, 217);PlotIndexSetDouble(DRAW_NONE,PLOT_EMPTY_VALUE, EMPTY_VALUE);
    // SetIndexBuffer(7,pDn); SetIndexStyle(7,DRAW_ARROW);SetIndexArrow(7,218); SetIndexEmptyValue(7,0.0); 
       SetIndexBuffer(7,pDn);PlotIndexSetInteger(7,PLOT_COLOR_INDEXES,1);PlotIndexSetInteger(7, PLOT_ARROW, 218);PlotIndexSetDouble(DRAW_NONE,PLOT_EMPTY_VALUE, EMPTY_VALUE);

После компиляции выдаёт

';' - unexpected end of program ARRZZX2.mq5     84      173
'{' - unbalanced parentheses    ARRZZX2.mq5     65      1

Появился ещ1ё один вопрос.

Допустим у оригинала (индикатор на mql4) есть строки

SetIndexEmptyValue(0,0.0);................SetIndexEmptyValue(4,0.0);
команду( на mql4 ) SetIndexEmptyValue я заменил на команду mql5 PlotIndexSetDouble
PlotIndexSetDouble(DRAW_NONE,PLOT_EMPTY_VALUE, EMPTY_VALUE);

Вопрос? что делать с параметрами команды SetIndexEmptyValue если данная команда у меня повторяется N количество раз и меняется только 1 параметр

 
Sergey Zhilinskiy:

Читаем что означает эта функция и какие параметры у нее должны быть https://www.mql5.com/ru/docs/convert/integertostring

спасибо

 
Игорь:

спасибо

PlotIndexSetDouble(0,PLOT_EMPTY_VALUE, 0.0);.....................PlotIndexSetDouble(5,PLOT_EMPTY_VALUE, 0.0);

Вот что у меня получилось.

 

При компиляции 2 блока

int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &High[],
                constdouble  &Low[],
                const double &Close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])


{
   int counted_bars=IndicatorCounted();

   if(counted_bars<0) return(-1);
   if(counted_bars>0) counted_bars--;

   if(First==true)
   { 
      if(SR<2) SR=2; 
      if(Bars<=2*(MainRZZ+FP+SR+2)) return(-1); 
      if(SRZZ<=SR) SRZZ=SR+1; 
         MaxBar = Bars -(MainRZZ+FP+SR+2);
         LBZZ   = MaxBar; 
         SBZZ   = LBZZ;
         prevBars=Bars;
      First=false;
   }
   
    if(prevBars!=Bars)
   {
         SBZZ    = Bars - nSBZZ;
         LBZZ    = Bars - nLBZZ;
         prevBars= Bars;
   } 
     
   if (alertsOn)
   {
      if (alertsOnCurrent)
         int whichBar = 0;
      else   whichBar = 1;
               
      static string   type1 = "";
      static datetime time1 = 0;
          if (Up[whichBar]  > 0)  Alert(type1,time1, " trend changeed to UP");
          if (Dn[whichBar]  > 0)  Alert(type1,time1, " trend changeed ro DOWN");
      static string   type2 = "";
      static datetime time2 = 0;
          if (Lmt[whichBar]!= 0)  Alert(type2,time2, " Exit");
   }   
}

ругается на:   int counted_bars=IndicatorCounted();


')' - expression expected	ARRZZX2.mq5	113	38

а также ругается на математические знаки и многое другое:

'<=' - open parenthesis expected        ARRZZX2.mq5     121     14
'-' - open parenthesis expected ARRZZX2.mq5     123     24
';' - open parenthesis expected ARRZZX2.mq5     126     23
')' - open parenthesis expected ARRZZX2.mq5     130     22
'-' - open parenthesis expected ARRZZX2.mq5     132     25
'-' - open parenthesis expected ARRZZX2.mq5     133     25
';' - open parenthesis expected ARRZZX2.mq5     134     24
declaration of 'whichBar' hides global variable ARRZZX2.mq5     140     14
see previous declaration of 'whichBar'  ARRZZX2.mq5     51      5

Люди "пините" меня в нужном направлении, я что то не вижу ошибок. всё сам подправлю.

Причина обращения: