Why doesn't it plot in the past?!

 
I'm trying to program an efficiency indicator, but got into a problem. I want to divide to variables, which both are plotted correctly in past individualla, but once divided it only plots for the two last bars. I've tried a few different combinations, but everytime i get to the same problem (must be something wrong with my understanding of the code).

Take a look at the following code:

#property indicator_separate_window
#property indicator_buffers 8
#property indicator_color1 Red
#property indicator_color2 Blue

//---- buffers
double ExtMapBuffer1[];
extern int length=15;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,ExtMapBuffer1);
   string short_name = "Fucking test at:";
   IndicatorShortName(short_name);
   
//----
   return(1);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//---- 
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int counted_bars=IndicatorCounted();
   if (counted_bars<0) return(-1);
   //---- last counted bar will be recounted
     if (counted_bars>0) counted_bars--;
   int pos=Bars-counted_bars; //---- main calculation loop
   while(pos>=0)
     {     
     double summation[1000];
     summation[pos]=iATR(Symbol(),NULL,length,pos)*length;
     ExtMapBuffer1[pos]= (iClose(Symbol(),NULL,pos)-iClose(Symbol(),NULL,pos+length))/summation[pos];
   pos--;
     }
//----
   return(0);
  }
//+------------------------------------------------------------------+



If I plot iClose(Symbol(),NULL,pos)-iClose(Symbol(),NULL,pos+length)) the ExtMapBuffer1 shows the right graph, and if I plot summation[pos] it also show the right values for all bars in past... but when i divide the two, I only get plots for the two last bars.

Anyone who can explain this phenomemon for me?

Thank you in advance,
Johan

 
int pos=Bars-counted_bars; //---- main calculation loop
while(pos>=0)

the indicator is only plotting the bars that the system tells it have "not already been counted"

for a test, change to:

int pos=1000;
while(pos>=0)

and it should always plot 1000 bars.