Array without specified amount of items

 


double Buffer1[];

double Buffer2[];

int OnInit()

  {   
   SetIndexBuffer(0, Buffer1);
   PlotIndexSetDouble(0, PLOT_EMPTY_VALUE, 0);
   PlotIndexSetInteger(0, PLOT_ARROW, 241);
   SetIndexBuffer(1, Buffer2);
   PlotIndexSetDouble(1, PLOT_EMPTY_VALUE, 0);
   PlotIndexSetInteger(1, PLOT_ARROW, 242);
   //initialize myPoint
   myPoint = Point();
   if(Digits() == 5 || Digits() == 3)
     {
      myPoint *= 10;
     }
   return(INIT_SUCCEEDED);
  }

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime& time[],
                const double& open[],
                const double& high[],
                const double& low[],
                const double& close[],
                const long& tick_volume[],
                const long& volume[],
                const int& spread[])
  {
   int limit = rates_total - prev_calculated;
   //--- counting from 0 to rates_total
   ArraySetAsSeries(Buffer1, true);
   ArraySetAsSeries(Buffer2, true);
   //--- initial zero
   if(prev_calculated < 1)
     {
      ArrayInitialize(Buffer1, 0);
      ArrayInitialize(Buffer2, 0);
     }
   else

      limit++;



I have this pre-built code, it seems that they have made an array for the buffer, but nowhere they specify out of how many items the array consists. I don't see something like Buffer1[5000], so where do they handle this?



 

It's a dynamic array and all the resizing happens here

SetIndexBuffer(1, Buffer2);
 
armandaneshvar:
   PlotIndexSetDouble(0, PLOT_EMPTY_VALUE, 0);
   PlotIndexSetInteger(0, PLOT_ARROW, 241);
   SetIndexBuffer(1, Buffer2);


I have this pre-built code, it seems that they have made an array for the buffer, but nowhere they specify out of how many items the array consists. I don't see something like Buffer1[5000], so where do they handle this?
  1. When you post code please use the SRC button !
  2. MT4 doesn't have those functions.
  3. Perhaps you should read the manual.
    For indicator buffers, all operations of size changes are performed by the executing sub-system of the terminal.