Discussion of article "The power of ZigZag (part I). Developing the base class of the indicator" - page 7

 
Sergey Voytsekhovsky:

Downloaded a new archive, tried to compile TestZZ_03.mq5

The result is the same. Error and reference to the same function initiated twice with different parameters.

Show the code of the CZigZagModule::GetZigZagData() method, in which buffer numbers should be passed.

 
TestZZZ_03 and TestZZZ_04 do not appear among the loaded EAs, so TestZZ_04 is not compiled either.
 
Anatoli Kazharski:

Show the code of the CZigZagModule::GetZigZagData() method, where you need to pass buffer numbers.

void CZigZagModule::GetZigZagData(const double &zz_h[],const double &zz_l[],const datetime &time[])

{

int h_total =::ArraySize(zz_h);

int l_total =::ArraySize(zz_l);

int total =h_total+l_total;

//--- Zero ZZ variables

ZeroZigZagData();

//--- Let's loop through the copied ZZ values

for(int i=0; i<total; i++)

{

//--- If we have already obtained the required number of ZZ maxima and minima, exit the loop

if(m_counter_highs==m_copy_extremums && m_counter_lows==m_copy_extremums)

break;

//--- Control of array overrun

if(i>=h_total || i>=l_total)

break;

//--- Fill the array of maxima until the required number is copied

if(zz_h[i]>0 && m_counter_highs<m_copy_extremums)

{

m_zz_high[m_counter_highs] =zz_h[i];

m_zz_high_bar[m_counter_highs] =i;

m_zz_high_time[m_counter_highs] =time[i];

//--- Increase the highs counter

m_counter_highs++;

}

//--- Fill the minimums array until we have copied the required number of minimums

if(zz_l[i]>0 && m_counter_lows<m_copy_extremums)

{

m_zz_low[m_counter_lows] =zz_l[i];

m_zz_low_bar[m_counter_lows] =i;

m_zz_low_time[m_counter_lows] =time[i];

//--- Increase the count of minima

m_counter_lows++;

}

}


 
Sergey Voytsekhovsky:
TestZZZ_03 and TestZZZ_04 do not appear among the uploaded Expert Advisors, so TestZZ_04 is not compiled either.

Then try to figure out why they don't appear. I have looked through the archive again. Everything for tests is there.

 
Anatoli Kazharski:

Show the code of the CZigZagModule::GetZigZagData() method, to which you need to pass buffer numbers.

void CZigZagModule::GetZigZagData(const int handle,int buffer_num_highs,int buffer_num_lows,

const string symbol,const ENUM_TIMEFRAMES period,

const datetime start_time,const datetime stop_time)

{

//--- Let's get the initial data

int times_total =::CopyTime(symbol,period,start_time,stop_time,m_zz_time_temp);

int highs_total =::CopyBuffer(handle,2,0,times_total,m_zz_highs_temp);

int lows_total =::CopyBuffer(handle,3,0,times_total,m_zz_lows_temp);

//--- Maximum number of extrema

int max_items =(int)::fmax((double)highs_total,(double)lows_total);

//--- If it is not enough, let's try again

if(times_total<max_items)

{

while(true)

{

::Sleep(100);

times_total=::CopyTime(symbol,period,start_time,stop_time,m_zz_time_temp);

if(times_total>=max_items)

break;

}

}

//--- Counters

int lows_counter =0;

int highs_counter =0;

//--- Counting highs

int h_total=::ArraySize(m_zz_highs_temp);

for(int i=0; i<h_total; i++)

{

if(m_zz_highs_temp[i]>0)

highs_counter++;

}

//--- Count the minima

int l_total=::ArraySize(m_zz_lows_temp);

for(int i=0; i<l_total; i++)

{

if(m_zz_lows_temp[i]>0)

lows_counter++;

}

//--- Get the number of extrema

int copy_extremums=(int)::fmin((double)highs_counter,(double)lows_counter);

CopyExtremums(copy_extremums);

//--- Let's loop through the copied ZZ values

GetZigZagData(m_zz_highs_temp,m_zz_lows_temp,m_zz_time_temp);

}

 
Sergey Voytsekhovsky:

...

Insert the code correctly:

//---

This is the wrong method. This is the one with this list of parameters:

//+------------------------------------------------------------------+
//|| Gets ZZ data from the passed handle |
//+------------------------------------------------------------------+
void CZigZagModule::GetZigZagData(const int handle,int buffer_num_highs,int buffer_num_lows,
                                  const string symbol,const ENUM_TIMEFRAMES period,
                                  const datetime start_time,const datetime stop_time)
 

Both methods are written in an inline file.

First page 217.

Second p 258

 
Sergey Voytsekhovsky:

...

You didn't replace the files. Delete them all. And re-download from the last archive: https: //www.mql5.com/ru/forum/299970/page6#comment_10495849

Обсуждение статьи "ZigZag всему голова (Часть I). Разработка базового класса индикатора"
Обсуждение статьи "ZigZag всему голова (Часть I). Разработка базового класса индикатора"
  • 2019.02.03
  • www.mql5.com
Опубликована статья ZigZag всему голова (Часть I). Разработка базового класса индикатора: Автор: Anatoli Kazharski...
 
deleted everything, downloaded a new archive, there is only the Files folder, now both 1 and 2 variants of the EA are gone. .... Or did I delete too much ??? ?
 
If I delete MT5 from my computer and install a new one, what do I need to download ? The old archive and on top of it a new one ? Just a new one? Something I'm completely confused about the archives. The old one puts 1 and 2 options, but not correctly. The new one doesn't put anything, should work correctly, but it's obviously not enough. Pardon my file illiteracy, but I can't find a normal explanation or instruction for what files in MT5 are responsible for what.