ma_shift





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

#property indicator_chart_window
#property indicator_buffers    6
#property indicator_color1     Blue
#property indicator_color2     Blue
#property indicator_color3     DodgerBlue
#property indicator_color4     Tomato
#property indicator_color5     Red
#property indicator_color6     Maroon

//#property indicator_width1     2
//#property indicator_width2     2
#property indicator_width3     2
#property indicator_width5     2

#property indicator_style1     4
#property indicator_style2     4


#property indicator_style4     2
#property indicator_style6     2



extern int period1      = 2;
extern int method1      = 0;
extern int price1       = 0;


extern int period2      = 3;
extern int method2      = 0;
extern int price2       = 0;

extern int shift2a      = 5;
extern int shift2b      = 7;
extern int shift2c      = 9;


double buffer1[];
double buffer2[];
double buffer3[];
double buffer4[];
double buffer5[];
double buffer6[];

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

int init()
{
      IndicatorBuffers(6); 

   
   SetIndexBuffer(0,buffer1);
   SetIndexBuffer(1,buffer2);
   SetIndexBuffer(2,buffer3);
   SetIndexBuffer(3,buffer4);
   SetIndexBuffer(4,buffer5);
   SetIndexBuffer(5,buffer6);

   SetIndexShift(3,shift2a);
   SetIndexShift(4,shift2b);
   SetIndexShift(5,shift2c);


   IndicatorShortName("ma shift " +period2);  
   SetIndexLabel(0,"ma1hi");
   SetIndexLabel(1,"ma1lo");
   SetIndexLabel(2,"ma1");
   SetIndexLabel(3,"ma2 "+period2+" shift a "+shift2a);
   SetIndexLabel(4,"ma2 "+period2+" shift b "+shift2b);
   SetIndexLabel(5,"ma2 "+period2+" shift c "+shift2c);



   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, period1, 0,method1 , PRICE_HIGH, i); 
     buffer2[i]  = iMA(NULL, 0, period1, 0,method1 , PRICE_LOW, i); 
 
     buffer3[i]  = iMA(NULL, 0, period1, 0,method1 , price1, i); 
 
     buffer4[i]  = iMA(NULL, 0, period2, 0,method2 , price2, i); 
     buffer5[i]  = iMA(NULL, 0, period2, 0,method2 , price2, i); 
     buffer6[i]  = iMA(NULL, 0, period2, 0,method2 , price2, i); 
 
   
  }
   
   return(0);
}






Sample





Analysis



Market Information Used:



Indicator Curves created:



Indicators Used:

Moving average indicator


Custom Indicators Used:

Order Management characteristics:

Other Features: