ma_x2_roc





//+------------------------------------------------------------------+
//|                                                                  |
//|                                                                  |
//+------------------------------------------------------------------+
//2009fxtsd ma x2
#property copyright ""
#property link      ""

#property indicator_separate_window
#property indicator_buffers    2
#property indicator_color1     Blue
#property indicator_color2     Red

//#property indicator_width1     1

#property indicator_level1      0.03
#property indicator_level2     -0.03
#property indicator_levelcolor DarkSlateGray




extern int ma1period      = 7;
extern int ma1method      = 1;
extern int ma1price       = 0;

extern int ma2period      = 13;
extern int ma2method      = 1;
extern int ma2price       = 0;

extern int slopePeriod=1;


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

int init()
{
      IndicatorBuffers(4); 

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

   IndicatorShortName("2ma roc " );  
   SetIndexLabel(0,"ma1 "+ma1period);
   SetIndexLabel(1,"ma2"+ma2period);



   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--)
   {
     buffer3[i]  = iMA(NULL, 0, ma1period, 0,ma1method, ma1price, i); 
     buffer4[i]  = iMA(NULL, 0, ma2period, 0,ma2method, ma2price, i); 


         if (buffer3[i]&&buffer4[i]!=0)
         {
          buffer1[i]=100*(buffer3[i]-buffer3[i+slopePeriod])/buffer3[i];
          buffer2[i]=100*(buffer4[i]-buffer4[i+slopePeriod])/buffer4[i];
          }
   
  }
   
   return(0);
}






Sample





Analysis



Market Information Used:



Indicator Curves created:



Indicators Used:

Moving average indicator


Custom Indicators Used:

Order Management characteristics:

Other Features: