Why not can compute ExtMapBuffer5[i]?

 
 
//+------------------------------------------------------------------+
//|                                                     AMA_TEST.mq4 |
//|                       Copyright ?2004, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright ?2004, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

#property indicator_separate_window
#property indicator_buffers 8
#property indicator_color1 Red
#property indicator_color2 Red
#property indicator_color3 Red
#property indicator_color4 Red
#property indicator_color5 Blue
#property indicator_color6 Red
#property indicator_color7 Red
#property indicator_color8 Red

//---- input parameters
extern int       N=15;
extern int       P=5;
extern int       Q=30;
extern int       K=15;
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];
double ExtMapBuffer5[];
double ExtMapBuffer6[];
double ExtMapBuffer7[];
double ExtMapBuffer8[];
double swip;
double FastC;
double SlowC;
double SCC[];
double yy[];
double Constant[];
double AMA[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   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);
   SetIndexStyle(4,DRAW_LINE);
   SetIndexBuffer(4,ExtMapBuffer5);
   SetIndexStyle(5,DRAW_LINE);
   SetIndexBuffer(5,ExtMapBuffer6);
   SetIndexStyle(6,DRAW_LINE);
   SetIndexBuffer(6,ExtMapBuffer7);
   SetIndexStyle(7,DRAW_LINE);
   SetIndexBuffer(7,ExtMapBuffer8);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//---- TODO: add your code here
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
    //---- TODO: add your code here
    int limit;
   int counted_bars=IndicatorCounted();
//---- check for possible errors
   if(counted_bars<0) return(-1);
//---- last counted bar will be recounted
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;
//---- TODO: add your code here
 for(int i=0; i<limit; i++)
 {
 ExtMapBuffer3[i]=Close[i]-Close[i+N];
 ExtMapBuffer1[i]=MathAbs(Close[i+1]-Close[i]);
   }
 for(i=0;i<limit;i++)
 {
 swip=0;
 for(int j=0; j<N; j++)
 {
 swip=swip+ExtMapBuffer1[i+j];
 ExtMapBuffer2[i]=swip;
 }
 ExtMapBuffer4[i]=MathAbs(ExtMapBuffer3[i]/ExtMapBuffer2[i]);
 
 FastC=2/(P+1);
 SlowC=2/(Q+1);
 ExtMapBuffer5[i]=(ExtMapBuffer4[i]*(FastC-SlowC)+SlowC)*(ExtMapBuffer4[i]*(FastC-SlowC)+SlowC);
 
 }
 
 
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
 
FastC and SlowC are 0 because P and Q are integers.
You need to use float arithmetics
FastC=2.0/(P+1);
SlowC=2/(Q+1.0);


why do You calculate invariant expressions in the loop?

Reason: