MAX Moving Average





#property link      "http://www.themovingaverage.com"
#property indicator_chart_window

#property indicator_buffers 4
#property indicator_color1 Red
#property indicator_color2 Red
#property indicator_color3 Red
#property indicator_color4 Red

double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];

extern int firstback=50;
extern int secondback=14;
extern int countbars=200;
extern int power=2;

int init()
  {
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexBuffer(1,ExtMapBuffer2);
   SetIndexStyle(2,DRAW_LINE);
   SetIndexBuffer(2,ExtMapBuffer3);
   SetIndexStyle(3,DRAW_LINE);
   SetIndexBuffer(3,ExtMapBuffer4);
   return(0);
  }
int deinit()
  {
   return(0);
  }
int start()
  {
   int counted_bars=IndicatorCounted();
   int pos;
   int cnt;
   int mult;
   double first,second;
   ArrayInitialize(ExtMapBuffer1,0);
   ArrayInitialize(ExtMapBuffer2,0);
   pos=countbars;
   while (pos>-1)
   {
      mult=firstback+1;
      first=0;
      second=0;
      for (cnt=pos;cnt<pos+firstback;cnt++)   
      {
         mult--;
         first=first+(Close[cnt]*MathPow(mult,power));
         Print (cnt);
      }
      mult=firstback+1;
      for (cnt=pos;cnt<pos+firstback;cnt++)   
      {
         mult--;
         second=second+MathPow(mult,power);
      }
      ExtMapBuffer1[pos]=first/second;
      pos--;
   }

   pos=countbars;
   while (pos>-1)
   {
      mult=secondback+1;
      first=0;
      second=0;
      for (cnt=pos;cnt<pos+secondback;cnt++)   
      {
         mult--;
         first=first+(Close[cnt]*MathPow(mult,power));
         Print (cnt);
      }
      mult=secondback+1;
      for (cnt=pos;cnt<pos+secondback;cnt++)   
      {
         mult--;
         second=second+MathPow(mult,power);
      }
      ExtMapBuffer2[pos]=first/second;
      pos--;
   }
   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:



Custom Indicators Used:

Order Management characteristics:

Other Features: