MA_PriceCcrossClose





//+------------------------------------------------------------------+
//|                                                            MA_xP |
//+------------------------------------------------------------------+
//2008fxtsd  ki  
#property copyright ""
#property link      ""

#property indicator_chart_window
#property indicator_buffers 3

#property indicator_color1 Yellow
#property indicator_color2 Maroon
#property indicator_color3 SlateBlue



extern int ma_period  =9;
extern int ma_method =1;
extern int ma_price  =0;

double Buffer1[];
double Buffer2[];
double Buffer3[];



//+---

int init()
  {

  SetIndexBuffer(0,Buffer1);  SetIndexStyle(0,DRAW_LINE);
  SetIndexBuffer(1,Buffer2);  SetIndexStyle(1,DRAW_LINE);
  SetIndexBuffer(2,Buffer3);  SetIndexStyle(2,DRAW_LINE);


   return(0);
  }

//+----


int start()
{
   int i,limit;
   int counted_bars=IndicatorCounted();

   if(counted_bars<0) return(-1);
   if(counted_bars>0) counted_bars--;

   limit = Bars-counted_bars;

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

   double MA=iMA(NULL,0,ma_period,0,ma_method,ma_price,i) ;


   Buffer1[i] = MA;   
   Buffer2[i] = EMPTY_VALUE; 
   Buffer3[i] = EMPTY_VALUE;
      
      
   if (Close[i]<MA) Buffer2[i]= MA;   
   if (Close[i]>MA) Buffer3[i]= MA;

   }
 
  
   return(0);
}
//+---------------



Sample





Analysis



Market Information Used:

Series array that contains close prices for each bar


Indicator Curves created:

Implements a curve of type DRAW_LINE


Indicators Used:

Moving average indicator


Custom Indicators Used:

Order Management characteristics:

Other Features: