how to make EA from zigzag

 

hi

i want to know amount of 3 last up and down in zigzag?

i could comment them in indicator but i comment them in zigzag as an EA my program show 0

what is wrong in my program that zigzag function does not work now?

Comment(curlow," ",curhigh," ",lastlow," ",lasthigh);

 

show your code

 

i just copy zigzag code in my EA as an function and put Comment in my program to show these numbers when i call zigzag function

do you need zigzag program?

 

EA!=Indicator (EA have no buffers)

//z

 

yes i know it but i wanted to know how can i make a function that exactly works such as zigzag indicator

and i become able to reach its number for my use

 

u don't need to copy the indicator into the EA use iCustom()

   int n, i, 
   double p0, p1, p2, p3, p4, p5;
   i=0;
      while(n<5)
      {
      if(p0>0) {p5=p4; p4=p3; p3=p2; p2=p1; p1=p0; }
      p0=iCustom(Symbol(),0,"zigzag",ExtDepth,ExtDeviation,ExtBackstep,0,i);
      if(p0>0) {n+=1; }
      i++;
      }
//now u have the numbers use it how you want
//4 example
if (p0 > p2 && p1 < p3)
   {
   //do X;
   }
 
smsafaee:

yes i know it but i wanted to know how can i make a function that exactly works such as zigzag indicator

and i become able to reach its number for my use


these three articles [perhaps in order listed] will guide you in creating EA based indicator function

  1. Transferring an Indicator Code into an Expert Advisor Code. Indicator Structure https://www.mql5.com/en/articles/1456
  2. Transferring an Indicator Code into an Expert Advisor Code. Conclusion https://www.mql5.com/en/articles/1463
  3. Transferring an Indicator Code into an Expert Advisor Code. General Structural Schemes of an Expert Advisor and Indicator Functions https://www.mql5.com/en/articles/1457


hope that answers your question

 

When i first discovered the zigzag indicator i too wanted to make an EA out of it. it points out the exact maximum and minimum values through the chart, i could just enter long when a new min is reached and enter short when a new max is reached. You can't loose -- I was going to be a billionaire in no time. This is wonderful!

...

And before i could decide what to do with all the billions I would make, I figured out that it doesn't really know the future, it just redraws on the charts.

:(

Reason: