Discussion of article "20 Trade Signals in MQL5" - page 4

 

Thanks to the author for the article!

Don't do what 1CMaster advises, it's just nonsense.

Do something else, put a vertical line on the chart, moving which indicators show the state of this moment (where is the vertical line), and not the current one?

 

The code might be of good value but some of the indicators are redundant:

BB and Standard Deviation Channel - same thing;

Price , Donchian and Gallagher  Channels - same thing;

Anyway, thanks for the article... 

Documentation on MQL5: Standard Constants, Enumerations and Structures / Objects Constants / Object Properties
  • www.mql5.com
Standard Constants, Enumerations and Structures / Objects Constants / Object Properties - Documentation on MQL5
 

Alligator signal formation error

.....
      if(CopyBuffer(h_al,0,0,2,al1_buffer)<2)
         return(0);
      if(CopyBuffer(h_al,1,0,2,al2_buffer)<2)
         return(0);
      if(CopyBuffer(h_al,2,0,2,al3_buffer)<2)
         return(0);
      if(!ArraySetAsSeries(al1_buffer,true))
         return(0);
      if(!ArraySetAsSeries(al2_buffer,true))
         return(0);
      if(!ArraySetAsSeries(al3_buffer,true))
         return(0);
     }
//--- check the condition and set the value for sig
   if(al3_buffer[1]>al2_buffer[1] && al2_buffer[1]>al1_buffer[1])
      sig=1;
   else if(al3_buffer[1]<al2_buffer[1] && al2_buffer[1]<al1_buffer[1])
      sig=-1;
   else sig=0;

//--- return the trade signal
   return(sig);
  }


Copying of these buffers is necessary taking into account the shift of indicator lines, but here it is not.

Second, why copy two indicator values if only one bar is compared, i.e. one value for each buffer (line) is enough.

Signal from AO: a lot of data is also copied (they do not participate in the analysis).

     if(CopyBuffer(h_ao,1,0,20,ao_buffer)<20)
         return(0);
      if(!ArraySetAsSeries(ao_buffer,true))
         return(0); 

And at the beginning of the article it was said that in order to remove the rattle we will analyse not the zero but the first bar in the history, why copy the zero bar?

We do not save resources ....

Документация по MQL5: Стандартные константы, перечисления и структуры / Константы индикаторов / Линии индикаторов
Документация по MQL5: Стандартные константы, перечисления и структуры / Константы индикаторов / Линии индикаторов
  • www.mql5.com
Стандартные константы, перечисления и структуры / Константы индикаторов / Линии индикаторов - Документация по MQL5
 
olyakish:

Alligator signal formation error


Copying of these buffers is necessary taking into account the shift of indicator lines, but here it is not.

Second, why copy two indicator values if only one bar is compared, i.e. one value for each buffer (line) is enough.

Signal from AO: a lot of data is also copied (they do not participate in the analysis).

And at the beginning of the article it was said that in order to remove the rattle we will analyse not the zero but the first bar in the history, why copy the zero bar?

We do not save resources ....



First of all, it is clearly written in the help.

Необходимо помнить, что смещение линии является чисто визуальным для отображения и значения в индикаторном буфере хранятся без смещения. 
При получении значений буфера функцией CopyBuffer() значение смещения никакого эффекта иметь не будет.

Secondly, I may have made some mistakes with data copying, but it does not affect the main point of the task. The purpose of the article is to show how to correctly address indicators and data.

 

By the way, I personally use such a construction, in this case the data from the function can be passed directly to the trade query.

ENUM_ORDER_TYPE ind_01()
  {
   ENUM_ORDER_TYPE sig=WRONG_VALUE;

   if(IND01_handle==INVALID_HANDLE || IND01_handle==0)
     {
      IND01_handle=iAC(_Symbol,TF_01);
      return(WRONG_VALUE);
     }
   else
     {
      if(CopyBuffer(IND01_handle,1,0,AC_shift+3,IND01_buffer1)<AC_shift+3) return(WRONG_VALUE);
      if(!ArraySetAsSeries(IND01_buffer1,true)) return(WRONG_VALUE);

      if(CopyBuffer(IND01_handle,0,0,AC_shift+1,IND01_buffer2)<AC_shift+1) return(WRONG_VALUE);
      if(!ArraySetAsSeries(IND01_buffer2,true)) return(WRONG_VALUE);
     }

   if(IND01_buffer2[AC_shift]>0.0 && IND01_buffer1[AC_shift]==0 && IND01_buffer1[AC_shift+1]==0)sig=ORDER_TYPE_BUY;
   else if(IND01_buffer2[AC_shift]<0.0 && IND01_buffer1[AC_shift]==0 && IND01_buffer1[AC_shift+1]==0 && IND01_buffer1[AC_shift+2]==0)sig=ORDER_TYPE_BUY;
   else if(IND01_buffer2[AC_shift]<0.0 && IND01_buffer1[AC_shift]==1 && IND01_buffer1[AC_shift+1]==1)sig=ORDER_TYPE_SELL;
   else if(IND01_buffer2[AC_shift]>0.0 && IND01_buffer1[AC_shift]==1 && IND01_buffer1[AC_shift+1]==1 && IND01_buffer1[AC_shift+2]==1)sig=ORDER_TYPE_SELL;
   else sig=WRONG_VALUE;

   return(sig);
  }
Документация по MQL5: Стандартные константы, перечисления и структуры / Структуры данных / Структура торгового запроса
Документация по MQL5: Стандартные константы, перечисления и структуры / Структуры данных / Структура торгового запроса
  • www.mql5.com
Стандартные константы, перечисления и структуры / Структуры данных / Структура торгового запроса - Документация по MQL5
 
sergey1294:

First of all, it is clearly written in the help

Secondly, I may have made some mistakes with data copying, but it does not affect the main point of the task. The purpose of the article is to show how to correctly address indicators and data.

Yes, it is true visual, but we are oriented on the visual value when entering a deal and not on how they lie in the memory of the terminal, so we need to take this into account.

The correct way for alligator is 13 by 8, 8 by 5, 5 by 3 (standard values).

int TradeSignal_17()
  {
   int sig=0;

   if(h_al==INVALID_HANDLE)
     {
      h_al=iAlligator(Symbol(),Period(),13,0,8,0,5,0,MODE_SMMA,PRICE_MEDIAN);
      return(0);
     }
   else
     {
      if(CopyBuffer(h_al,0,8,2,al1_buffer)<2)
         return(0);
      if(CopyBuffer(h_al,1,5,2,al2_buffer)<2)
         return(0);
      if(CopyBuffer(h_al,2,3,2,al3_buffer)<2)
         return(0);
      if(!ArraySetAsSeries(al1_buffer,true))
         return(0);
      if(!ArraySetAsSeries(al2_buffer,true))
         return(0);
      if(!ArraySetAsSeries(al3_buffer,true))
         return(0);
     }
//--- check the condition and set the value for sig
   if(al3_buffer[1]>al2_buffer[1] && al2_buffer[1]>al1_buffer[1])
      sig=1;
   else if(al3_buffer[1]<al2_buffer[1] && al2_buffer[1]<al1_buffer[1])
      sig=-1;
   else sig=0;

//--- return the trade signal
   return(sig);
  }
 
olyakish:

Yes, it is true visual, but we are oriented on the visual value when entering a deal and not on the way they are in the terminal memory, so we need to take this into account.

The correct way for alligator is 13 on 8, 8 on 5, 5 on 3 (standard values).

I will not say, but I do not think that everyone uses the alligator with an offset. So there is no error in this case. You needed an offset you added it, so can the steel ones who need it. I will repeat once again, the purpose of the article is to show how to properly address the indicators and their data, and how much and in what quantity to get them is a matter of each individual.
 
sergey1294:
I'm not going to state it, but I don't think everyone uses an offset aligator. So there is no mistake in this case. You needed an offset, you added it, and so can the steel ones who need it. I will repeat once again, the purpose of the article is to show how to properly address indicators and their data, and how much and in what quantity to get them is a matter of each individual.

Reference...

Technical Indicator Alligator is a combination of Balance Lines (Moving Averages) using fractal geometry and non-linear dynamics.

  • The blue line (Alligator's Jaw) is the Balance Line for the time period used to construct the chart (13-period smoothed moving average, shifted 8 bars into the future);
  • The red line (Alligator's Teeth) is the Balance Line for a meaningful time period an order of magnitude lower (8-period smoothed moving average shifted 5 bars into the future);
  • The green line (Alligator Lips) is the Balance Line for a meaningful time period that is another order of magnitude lower (5-period smoothed moving average shifted 3 bars into the future).


The key words are in bold.

The result of your code is the analysis of averages

The result of my proposed code is the analysis of alligator lines.

 
These are really useful for learning, thanks.
 
Good for beginners like me, very  useful. thanks.