Download MetaTrader 5

Help with Choppy market indicator

To add comments, please log in or register

Hi I'm new in Mql4. I'm trying to create an ea based on the choppy market indicator. I've identified the buffers as follows:

   double cma=iCustom(NULL, 0, "CMI",60,10,false,3, 1);//smoothed ma

   double cmil = iCustom(NULL,0, "CMI", 60,10, false,0,1); //cmi line

   double cmilg=iCustom(NULL,0, "CMI", 60,10, false,1,1); // green line

   double cmilr=iCustom(NULL,0, "CMI",60,10, false,2,1); // red line

 Now i want the ea to buy if like picture below;


 Choppy Market Index indicator

 to buy:

 if cmi line is blue and greater than 60 and  green line is green then buy

 if(  cmil > 60 && cmilg  is green  && Count.Buy() == 0 )


 if the cmi line is blue and greater than 60 and the red  line is red is red then sell

 else if cmil > 60 && cmilr >  is red && Count.Sell() == 0)

 I've tried different combination but it doesn't seem to work properly. My problem is how to tell the programme that the colour has turned green or red. Have I made a mistake on buffers?

Please help . Thanks.

  1. What is the buffer values when the line is green vs red? Until you know that, you haven't "make a mistake." You don't know enough to code it.
  2. You should write a self documenting function instead of calling iCustom directly, see Detailed explanation of iCustom - MQL4 forum
Keith Watford
Keith Watford  

Usually when buffer lines are not visible, the buffer's value is EMPTY_VALUE

So you would check

cmilr >  is red



To add comments, please log in or register