can't initialize a Dynamic array

 
//+------------------------------------------------------------------+
//|                                                        test1.mq4 |
//|                                          Copyright 2013, name    |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright "Copyright 2013, name"
#property link      ""

//+------------------------------------------------------------------+
//| script program start function                                    |
//+------------------------------------------------------------------+
int start()
  {
//----
   double rsiHistory[];
   IndicatorBuffers(1);
   int ind_Counted = IndicatorCounted();
   int a = Bars - ind_Counted - 31;
   int b = Bars - ind_Counted - 1;
   SetIndexBuffer(1, rsiHistory);
   ArrayInitialize(rsiHistory, 0);
   for (int i=0;i<30;i++)
   {   
      rsiHistory[i]=NormalizeDouble(iRSI(NULL,0,14,PRICE_CLOSE,i),2);
      Alert (i + "==="+rsiHistory[i]);
   }
//----
Alert (ArraySize(rsiHistory));
//----
   return(0);
  }
//+------------------------------------------------------------------+

Can anyone help to check what wrong with my code? 

If i put rsiHistory[30], it will initialize the array, but what if I do not want it to be a fixed array, i want it to be Dynamic? please help

 

 
wslamvin00:

Can anyone help to check what wrong with my code? 

If i put rsiHistory[30], it will initialize the array, but what if I do not want it to be a fixed array, i want it to be Dynamic? please help

<CODE DELETED>

Please edit your post . . .    please use the   SRC   button to post code: How to use the   SRC   button.

 

You cannot use Dynamic arrays in mql4,  if you want to make an Array bigger or smaller then resize it using ArrayResize() 

If you are using Buffers in an Indicator then they are automatically resized for you . . . you declare them like this 

 double Buffer[]; 
 

  1. Play video
    Please edit your post.
    For large amounts of code, attach it.

  2. int start(){
       double rsiHistory[];                    <= Global not local
       IndicatorBuffers(1);                    <= in init()
       int ind_Counted = IndicatorCounted();
       int a = Bars - ind_Counted - 31;
       int b = Bars - ind_Counted - 1;
       SetIndexBuffer(1, rsiHistory);          <= in init()
       ArrayInitialize(rsiHistory, 0);         <= delete, it's a indicator buffer