Hi...

I tried to convert custom indicator to expert advisor. Based on the code, i tried to print out iMAONArray values but its return blank... Why and what is the fucntion used for ?.. Please help me

Code:
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_style1 STYLE_SOLID
#property indicator_width1 2
#property indicator_color2 Yellow
#property indicator_style2 STYLE_DOT

// List of input parameter
extern int     SF          = 45;
extern int     RSI_PERIOD  = 55;
extern double  DARFACTOR   = 2.236;
extern double  Lots        = 0.01;
extern int     ALERTLEVEL  = 50;

// List of Global Array
double TRLEVELSLOW[];
double ATRRSI[];
double MAATRRSI;
double RSI[];
double MA[];
double RSIMA;

// List of global variable
int WILDERS_PERIOD, LASTALERTBAR, STARTBAR, handle;
int TRACE = 1;

//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
{
   //---- Open trace file
   if (TRACE == 1)
      handle = FileOpen("BPower.csv",FILE_CSV|FILE_READ|FILE_WRITE,',');

   WILDERS_PERIOD = RSI_PERIOD * 2 - 1;
/*
   if (WILDERS_PERIOD < SF)
        STARTBAR = SF;
   else
        STARTBAR = WILDERS_PERIOD;

   //---- Write to test file for trace

   if (TRACE == 1) {
      if(handle < 1) {
         Comment("File BPower.csv not found, the last error is ", GetLastError());
         return(false);
      } else {
         FileWrite(handle, "TIME               ","BID  ","ASK");
      }
   }
  
   return(handle);
}
 
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit(bool handle)
{
   FileClose(handle);
   return(0);
}

//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
{
   int i =0;
   int COUNTED_BARS, COUNTED;  
   double RSI0, RSI1, DAR, TR, DV;
  
   if (TRACE == 1) {
      FileWrite (handle, "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
      FileWrite (handle, TimeToStr( TimeCurrent(), TIME_DATE | TIME_SECONDS ), Bid, Ask);
   }  

   if(Bars <= STARTBAR)
      return(0);

   COUNTED_BARS = IndicatorCounted();

   if (TRACE == 1)
      FileWrite (handle, "COUNTER_BARS: " + COUNTED_BARS);
   
   COUNTED = Bars - COUNTED_BARS - 1;
  
   if (TRACE == 1)
      FileWrite (handle, "COUNTED      : " + COUNTED);   

   for(i=COUNTED; i>=1; i--) {
      RSI[i]      = iRSI(NULL, 0, RSI_PERIOD, PRICE_CLOSE, i);
      //FileWrite(handle, "-> RSI        : " + iRSI(NULL, 0, RSI_PERIOD, PRICE_CLOSE, i));
   }      

   RSIMA=iMAOnArray(MA, 0, SF, 0, MODE_EMA, 0);
   FileWrite(handle, "-> RSIMA     : " + iMAOnArray(MA, 0, SF, 0, MODE_EMA, 0));

   return(0);
}
This is sample output file:-
Code:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2013.01.02 09:03:37,1.6315,1.6318
COUNTER_BARS: -1
COUNTED      : 1002
-> RSIMA     : 0.00000000
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2013.01.02 09:03:39,1.6314,1.6317
COUNTER_BARS: -1
COUNTED      : 1002
-> RSIMA     : 0.00000000
Please help me..


Thank you