Discussion of article "The ZigZag Indicator: Fresh Approach and New Solutions" - page 5

 
Total newbie question but how can I use automate this EA to open positions based on the indicator???
 

in the AdvancedZigZag.mqh i had to change


Line 74:   zzH[h]=(MqlZigZag)zz[i];  to     zzH[h].price=zz[i].value;

Line 80:   zzL[l]=(MqlZigZag)zz[i];    to    zzL[l].price=zz[i].value;


Also in the main program two_comment.mq5 the code block 

//--- check for integrity of preliminary calculations - the CopyBuffer function results in an error thus err=-1 and it returns thus the rest of the program does not execute..

I just commented out the error checking or just set int err=1 so the program block does not run. and now the EA works for me.


//--- check for integrity of preliminary calculations

   if(err<0)

     {

      //--- calculate the sums of deviations of the nodes from MA for ZigZag peaks

      ArrayInitialize(sumHi,0.0);

      for(int j=H-1; j>=0; j--)

        {

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

           {

            err=CopyBuffer(handle_MA_H[i],0,Azz.zzH[j].t,1,MA);

            if(err<0) return;

            sumHi[i]+=Azz.zzH[j].price-MA[0];

            //Print("No error! sumHi: ", sumHi[i]);

           }

        }

      //--- calculate the sums of deviations of the nodes from MA for ZigZag troughs

      Print("Error Number: ", err);

      ArrayInitialize(sumLo,0.0);

      for(int j=L-1; j>=0; j--)

        {

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

           {

            err=CopyBuffer(handle_MA_L[i],0,Azz.zzL[j].t,1,MA);

            if(err<0) return;

            sumLo[i]+=MA[0]-Azz.zzL[j].price;

           }

        }

     }

 

Please use the </> button to insert your above code.


 

Dear all,

I've compiled the files and I'm getting the following error message, how could I solve it?


 

Hello parkus,

replace line 74 with the piece of code marked in red.

I know you didn't ask, but the <advancedzigzag.mqh> and <getextremums.mqh> files should be copied to the <...\MQL5\Include\> directory. I recommend renaming the files advancedzigzag.mqh to AdvancedZigZag.mqh, getextremums.mqh to GetExtremums.mqh and finally two_comets.mq5 to AdvancedZigZag.mq5. As this last one is an expert, I copied it to the <...\MQL5\Experts\Advisors\Downloads\ZigZag\> directory to better organise the plugins.


Error correction

 
Would it be possible to use this Comets advisor in the mql4 version? Thank you
 
Such a good indicator can't be loaded seek advice! Which folder to put each file in
 
Please tell me what it does
 

Hi,

Can you please correct the source code and upload again?

I tried to compile and it showed 30 errors!

Thanks

 

zzH[h]=(MqlZigZag)zz[i];
h++;
}
else
{
& nbsp; zzL[l]=(MqlZigZag)zz[i]; cannot cast 'dextremum' to 'MqlZigZag'

cannot cast 'dextremum' to 'MqlZigZag' AdvancedZigZag.mqh 74 17
cannot cast 'dextremum' to 'MqlZigZag' AdvancedZigZag. mqh 79 17
cannot be read