ArrayCopy for Different Time Frames and Currencies - Need Help

 
Here is my current code:
            if (ArraySize(Close) > 101) 
               {
               ArrayCopy(ClosePriceArray, Close, 0, 1, 100);
               ArrayCopy(OpenPriceArray, Open, 0, 1, 100);
                }

 

How can I rewrite the code so that it will always address EURUSD, PERIOD_M15? I have tried the following code:

 

               ArrayCopyRates(double_array,"EURUSD",PERIOD_M15);
               ArrayCopy(ClosePriceArray, double_array[0][4],0,1,100);

 

I received the error message 'double_array" - array required.

 

BTW, how do I deal with  if (ArraySize(Close) > 101)? 

 
waterhorse: I received the error message 'double_array" - array required.
ArrayCopyRates(double_array,"EURUSD",PERIOD_M15);
  1. Show all the relevant code, like your declarations. How should we know what double_array is, unless you show it?
  2. MqlRates chartM15[];
    init(){ ArrayCopyRates(chartM15,"EURUSD",PERIOD_M15); ...}
    start(){
       Print("EURUSD close[1]="+chartM15[1].close);
 

WHRoeder,

Thanks for your reply:

 

Here is the declaration:

 

 

 

   double ClosePriceArray[];
   double OpenPriceArray[];

if (ArraySize(Close) > 101) 
               {
               ArrayCopy(ClosePriceArray, Close, 0, 1, 100);
               ArrayCopy(OpenPriceArray, Open, 0, 1, 100);
               RandVar = 0;
               if (doublecnt > 0.0) 
                  {
                  for (int cnt = 0; cnt < ArraySize(ClosePriceArray); cnt++) 
                     {
                     if (MathRand() > 383) RandVar = (MathRand() + 0.0001) / 767.0 * (doublecnt * Point);
                     else RandVar = (-(MathRand() + 0.0001)) / 767.0 * (doublecnt * Point);
                     ClosePriceArray[cnt] += RandVar;
                     }
                  for (cnt = 0; cnt < ArraySize(OpenPriceArray); cnt++) 
                     {
                     if (MathRand() > 383) RandVar = (MathRand() + 0.0001) / 767.0 * (doublecnt * Point);
                     else RandVar = (-(MathRand() + 0.0001)) / 767.0 * (doublecnt * Point);
                     OpenPriceArray[cnt] += RandVar;
                     }
                  }
               } 
 

Is there a way that we can limit the size of the ArrayCopyrates? It takes a long time for the backtesting

 

ArrayCopyRates(double_array,"EURUSD",PERIOD_M15);