Candle MA Long





//+------------------------------------------------------------------+
//|                  Guppy Mulitple Moving Average (Short double).mq4|
//|                                                  candlexu@163.Com|
//|                                                                  |
//+------------------------------------------------------------------+




#property copyright "2008 candlexu"


#property indicator_chart_window
//#property indicator_separate_window
#property indicator_buffers 6
#property indicator_color1 Aqua//Magenta
#property indicator_color2 Red
#property indicator_color3 Aqua
#property indicator_color4 Red
#property indicator_color5 Aqua
#property indicator_color6 Red

extern int long_26=  26;
extern int long_30=  30;
extern int long_35=  35;


//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer1_1[];
double ExtMapBuffer2[];
double ExtMapBuffer2_2[];
double ExtMapBuffer3[];
double ExtMapBuffer3_3[];


//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexBuffer(1,ExtMapBuffer1_1);
   SetIndexStyle(2,DRAW_LINE);
   SetIndexBuffer(2,ExtMapBuffer2);
   SetIndexStyle(3,DRAW_LINE);
   SetIndexBuffer(3,ExtMapBuffer2_2);
   SetIndexStyle(4,DRAW_LINE);
   SetIndexBuffer(4,ExtMapBuffer3);
   SetIndexStyle(5,DRAW_LINE);
   SetIndexBuffer(5,ExtMapBuffer3_3);
   
//----
   return(0);
  }

int deinit()
  {
   return(0);
  }

int start()
  {
   int i,j,limit,counted_bars=IndicatorCounted();
   
   
   if(counted_bars<0) return(-1);
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;
   
   for(i=0; i<limit; i++){
      ExtMapBuffer1[i]=iMA(NULL,0,long_26,0,MODE_EMA,PRICE_CLOSE,i);
      ExtMapBuffer2[i]=iMA(NULL,0,long_30,0,MODE_EMA,PRICE_CLOSE,i);
      ExtMapBuffer3[i]=iMA(NULL,0,long_35,0,MODE_EMA,PRICE_CLOSE,i);
      
   }
  for(j = Bars-counted_bars-1;j>=0;j--)
  {
      if(ExtMapBuffer1[j]>ExtMapBuffer1[j+1]) ExtMapBuffer1_1[j]=ExtMapBuffer1[j]; else ExtMapBuffer1_1[j]=EMPTY_VALUE;
      if(ExtMapBuffer2[j]>ExtMapBuffer2[j+1]) ExtMapBuffer2_2[j]=ExtMapBuffer2[j]; else ExtMapBuffer2_2[j]=EMPTY_VALUE;
      if(ExtMapBuffer3[j]>ExtMapBuffer3[j+1]) ExtMapBuffer3_3[j]=ExtMapBuffer3[j]; else ExtMapBuffer3_3[j]=EMPTY_VALUE;
  }

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



Sample





Analysis



Market Information Used:



Indicator Curves created:

Implements a curve of type DRAW_LINE


Indicators Used:

Moving average indicator


Custom Indicators Used:

Order Management characteristics:

Other Features: