ma_2c





//+------------------------------------------------------------------+
//|                                                                  |
//|                                                                  |
//+------------------------------------------------------------------+
//2009fxtsd 

#property copyright ""
#property link      ""

#property indicator_chart_window
#property indicator_buffers    3
#property indicator_color1     Green
#property indicator_color2     Red
#property indicator_color3     Red




extern int period      = 11;
extern int method      = 1;

extern int price       = 0;


double buffer1[];
double buffer2[];
double buffer3[];
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+

int init()
{

   
   SetIndexBuffer(0,buffer1);
   SetIndexBuffer(1,buffer2);
   SetIndexBuffer(2,buffer3);

//   IndicatorShortName("cci triple " +period);  
   SetIndexLabel(0,"ma2c " +period);



   return(0);
}


int deinit()
{
   return(0);
}

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+



int start()
{
   int counted_bars=IndicatorCounted();
   int limit,i;
   
   if(counted_bars<0) return(-1);
   if(counted_bars>0) counted_bars--;
           limit=Bars-counted_bars;


   for(i=limit; i>=0; i--)
   {

     buffer1[i]  = iMA(NULL, 0, period, 0,method , price, i); 

 
               buffer2[i]=EMPTY_VALUE;       buffer3[i]=EMPTY_VALUE;


      if (buffer1[i]<buffer1[i+1])
      {

            if(buffer2[i+2]==EMPTY_VALUE)   
            {
               buffer2[i]=buffer1[i];        buffer2[i+1]=buffer1[i+1];
                 }
                                    
            else                             
            {   
               buffer3[i]=buffer1[i];        buffer3[i+1]=buffer1[i+1];
                  }                  
      }
 
 
 
   
   }
   
   return(0);
}






Sample





Analysis



Market Information Used:



Indicator Curves created:



Indicators Used:

Moving average indicator


Custom Indicators Used:

Order Management characteristics:

Other Features: