[ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3. - page 395

 

Please advise if Alert works when testing EAs,

For some reason Comment works but Alert does not????

 
It works!!! For example, in my screenshot on page 393, what I wanted was entered in the log by alerts.
 
kolaider:

Please advise if Alert works when testing EAs,

For some reason Comment works but Alert does not????


It logs
 
//+----------------------------------------------------------------------------+
//|  Автор    : Ким Игорь В. aka KimIV,  http://www.kimiv.ru                   |
//+----------------------------------------------------------------------------+
//|  Версия   : 07.10.2006                                                     |
//|  Описание : Возвращает экстремум ЗигЗага по его номеру.                    |
//+----------------------------------------------------------------------------+
//|  Параметры:                                                                |
//|    sy - наименование инструмента   (NULL или "" - текущий символ)          |
//|    tf - таймфрейм                  (      0     - текущий ТФ)              |
//|    ne - номер экстремума           (      0     - последний)               |
//|    dp - ExtDepth                                                           |
//|    dv - ExtDeviation                                                       |
//|    bs - ExtBackstep                                                        |
//+----------------------------------------------------------------------------+
double GetExtremumZZPrice(string sy="", int tf=0, int ne=0, int dp=12, int dv=5, int bs=3) {
  if (sy=="" || sy=="0") sy=Symbol();
  double zz;
  int    i, k=iBars(sy, tf), ke=0;

  for (i=1; i<k; i++) {
    zz=iCustom(sy, tf, "ZigZag", dp, dv, bs, 0, i);
    if (zz!=0) {
      ke++;
      if (ke>ne) return(zz);
    }
  }
  Print("GetExtremumZZPrice(): Экстремум ЗигЗага номер ",ne," не найден");
  return(0);
}

Hello.

Can you tell me how I can paste the function attached here into the EA code to make it work?

I tried just to copy and paste it after Int Start(). I guess it's not that simple?

 
msl:

Hello.

Can you tell me how I can paste the function attached here into the EA code to make it work?

I tried just to copy and paste it after Int Start(). I guess it's not that simple?

1). I need to copy the function into the code.

2). And where you need to call the function, write, for example:

int start()
{
   // ...
   
   double ZZ = GetExtremumZZPrice(Symbol(), 0, 0, 12, 5, 3);
   
   // ...
}

// а функцию можно вставить например сюда:

//+----------------------------------------------------------------------------+
//|  Автор    : Ким Игорь В. aka KimIV,  http://www.kimiv.ru                   |
//+----------------------------------------------------------------------------+
//|  Версия   : 07.10.2006                                                     |
//|  Описание : Возвращает экстремум ЗигЗага по его номеру.                    |
//+----------------------------------------------------------------------------+
//|  Параметры:                                                                |
//|    sy - наименование инструмента   (NULL или "" - текущий символ)          |
//|    tf - таймфрейм                  (      0     - текущий ТФ)              |
//|    ne - номер экстремума           (      0     - последний)               |
//|    dp - ExtDepth                                                           |
//|    dv - ExtDeviation                                                       |
//|    bs - ExtBackstep                                                        |
//+----------------------------------------------------------------------------+
double GetExtremumZZPrice(string sy="", int tf=0, int ne=0, int dp=12, int dv=5, int bs=3) {
  if (sy=="" || sy=="0") sy=Symbol();
  double zz;
  int    i, k=iBars(sy, tf), ke=0;

  for (i=1; i<k; i++) {
    zz=iCustom(sy, tf, "ZigZag", dp, dv, bs, 0, i);
    if (zz!=0) {
      ke++;
      if (ke>ne) return(zz);
    }
  }
  Print("GetExtremumZZPrice(): Экстремум ЗигЗага номер ",ne," не найден");
  return(0);
}

 
msl:

Hello.

Can you tell me how I can paste the function attached here into the EA code to make it work?

I tried just to copy and paste it after Int Start(). I guess it's not that simple?


It's hard to understand what you mean by inserting it after int Start(), aren't you inserting it inside Start?

Just paste it at the very end of your code

 
Figar0:


It's hard to understand what you mean by inserting it after int Start(), aren't you inserting it inside Start?

Insert it just at the end of your code


Yes, was inside Start, now put it at the end. When compiling an error: is not referenced and will be removed from exp-file
 
msl:

Hello.

Can you tell me how I can paste the function attached here into the EA code to make it work?

I tried just to copy and paste it after Int Start(). I guess it's not that simple?

Hello. It's simple. You first need to understand the operation and purpose of the functions in general and that's it.
 
msl:

Yes, it was inside Start, now it's at the end. When compiling, you get an error: is not referenced and will be removed from exp-file

That's right - this error means that your fie is not being called for execution from your EA code and will be removed. Read the order of fie calls from my link in the previous post.
 
Roman.:

That's right - this error means that your fie is not being called for execution from your EA code and will be deleted, see the order of fie calls from my link in the previous post.

That's it, it's working. Thank you very much.
Reason: