iMAOnArray Problem

 

Can someone help me with my iMAOnArray? Where I am having problems, is getting my upper and lower indicator lines to print. When I run my ResBuffer array through the iMAOnArray, I do not get any numbers or results.

#property copyright "Copyright © 2011, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

#property indicator_chart_window

#property indicator_buffers 3       
#property indicator_color1 Gray    
#property indicator_color2 Red 
#property indicator_color3 Blue    

double MovingBuffer[];
double UpperBuffer[];
double LowerBuffer[];
double TempBuffer[];
double ResBuffer[];
double SupBuffer[];            
//--------------------------------------------------------------------
int init()                         
  {
   IndicatorBuffers(6);
//--------------------------------------------------------------------
   IndicatorShortName("PLdot");
//--------------------------------------------------------------------
   SetIndexBuffer(0,MovingBuffer);        
   SetIndexStyle (0,DRAW_LINE,STYLE_SOLID,1);
   SetIndexDrawBegin(0,0);
//--------------------------------------------------------------------
   SetIndexBuffer(1,UpperBuffer);         
   SetIndexStyle (1,DRAW_LINE,STYLE_SOLID,1);
   SetIndexDrawBegin(1,0);
//--------------------------------------------------------------------
   SetIndexBuffer(2,LowerBuffer);         
   SetIndexStyle (2,DRAW_LINE,STYLE_SOLID,1);
   SetIndexDrawBegin(2,0);
//--------------------------------------------------------------------
   SetIndexBuffer(3,ResBuffer);
   SetIndexBuffer(4,SupBuffer);
   SetIndexBuffer(5,TempBuffer);
   
   ArraySetAsSeries(ResBuffer,true);
   ArraySetAsSeries(SupBuffer,true);
   ArraySetAsSeries(TempBuffer,true);
   
   SetIndexShift(0,1);
   SetIndexShift(1,1);
   SetIndexShift(2,1);   

//--------------------------------------------------------------------
   return;                         
  }
//--------------------------------------------------------------------
int start()                        
  {
   int i,                           
       Counted_bars;               
//--------------------------------------------------------------------
   Counted_bars=IndicatorCounted(); 
   int    counted_bars=IndicatorCounted();
   int limit;
   limit = Bars - counted_bars - 1;
   
   for(i=limit-1;i>=0;i--)          
      {            
      RefreshRates();
      TempBuffer[i]=(((iClose(NULL,0,i)+iLow(NULL,0,i)+iHigh(NULL,0,i))/3) + ((iClose(NULL,0,i+1)+iLow(NULL,0,i+1)+iHigh(NULL,0,i+1))/3) + ((iClose(NULL,0,i+2)+iLow(NULL,0,i+2)+iHigh(NULL,0,i+2))/3))/3;
      }
      
   for(i=limit-1;i>=0;i--)          
      {            
      RefreshRates();
      MovingBuffer[i] = TempBuffer[i];
      ResBuffer[i] = ((TempBuffer[i]*2)-High[i]);
      //UpperBuffer[i]=ResBuffer[i];
      UpperBuffer[i]=iMAOnArray(ResBuffer,0,3,0,MODE_SMA,i);
      //LowerBuffer[i]=iMAOnArray(SupBuffer[i],0,2,0,MODE_SMA,i);
   //   }   
      }
      
   return(0);                         
  }
//-------------------------------------------------------------------
Files:
pldoti4.mq4  4 kb
 
Files:
pldoti4_1.mq4  4 kb
 

Vinin,

Thank you for your help.

Reason: