Find Double Top Double Bottom Pattern Using ZigZag Indicator MQL4 Code

ZigZag indicator is a highly useful indicator when it comes to finding the chart patterns. Chart patterns are very important in giving the clues about what the market is thinking of doing. If you are a naked trader then you must master chart patterns. Important chart patterns are double top double bottom, head and shoulder and If you are an MQL4 coder it can be a challenge to code these chart patterns. In this post we discuss how we can find the double top and double bottom pattern using ZigZag indicator. If you are not sure what a double top double bottom pattern, then first watch this youtube video!

Now this double top and double bottom pattern is very important and works in all markets whether you are trading stocks, currencies, commodities etc whatever. Now lets turn to coding MQL4 that will alert you when this pattern forms on the chart. How do you do it?

The best method to do it is using the Zigzag indicator.

This coder has done it beautifully using the ZigZag Pattern.

double getExtreme(int ne)


   int k=iBars(Symbol(),0);

   int ke=0;

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

   {double zz=iCustom(Symbol(), 0, "ZigZag",
ZigZagDepth,ZigZagDeviation,ZigZagBackStep, 0, i);

    if (zz!=0) {ke++; if (ke>ne) return(zz);}



Leave A Response