Download MetaTrader 5
To add comments, please log in or register
Have you published a program in the Market? Place it in your blog as well - the widget will help!
Ian Venner
2583
Ian Venner 2014.04.18 20:02 

I need to copy the last ten highs from the high[] array in OnCalculate()

   int Length = 10;
   double ahigh[];
   ArrayResize(ahigh,Length);
   ArrayCopy(ahigh,high,0,0,Length);
   for(int i=0; i<Length; i++)
   {
    Print("high[",i,"] = ",high[i]," ahigh[",i,"] = ",ahigh[i]);
   }
   int compare = ArrayCompare(high,ahigh,0,0,Length);
   Print("ArrayCompare = ",compare);

When I print them it looks ok but ArrayCompare() returns -1 why would that be ?

ArrayCompare = -1
high[9] = 1.3748 ahigh[9] = 1.3748
high[8] = 1.3811 ahigh[8] = 1.3811
high[7] = 1.3861 ahigh[7] = 1.3861
high[6] = 1.3898 ahigh[6] = 1.3898
high[5] = 1.3905 ahigh[5] = 1.3905
high[4] = 1.3862 ahigh[4] = 1.3862
high[3] = 1.3833 ahigh[3] = 1.3833
high[2] = 1.385 ahigh[2] = 1.385
high[1] = 1.3864 ahigh[1] = 1.3864
high[0] = 1.3822 ahigh[0] = 1.3822

Also if I call a value from the spread[] array,

Print(spread[0]);

I get array out of range error in the experts log.

/
To add comments, please log in or register