Increment the array size in the CopyTicks function

 

Hello,

I am quite new to coding and having quite a lot of fun setting myself tasks to become better - this one however I can't seem to get my head around 

Basically, I am trying to increment the array size in the CopyTicks function until the condition of its .last price is lower than my test price.last is met.

I am using ticks[0].last as my starting point and when my tick.last finally reaches my test price the loop bugs out which is fine, but until that point i would like to be adding data to the array but the array size always returns 6

I think I am on the right path but could do with a pointer in the right direction to make it work

Thank you :)

PTT 

void OnTimer()
  {
  
   double   testNumber = 1.05245; //this is a test random price i know is lower than the value at ticks[0].last
  
   MqlTick tick;
   double last=0;
   if(SymbolInfoTick(_Symbol,tick))
   last=tick.last;

   double arraySize = 6; // setting the starting value for the array size in the CopyTicks function  
   MqlTick ticks[]; // a dynamic array
   int copied=CopyTicks(_Symbol,ticks,COPY_TICKS_TRADE,0,(int)arraySize);
  
     for(int i=(int)arraySize;testNumber<ticks[0].last;i++){
         
         Print(ticks[0].last);
         int size=ArraySize(ticks);
         Print(size); //always prints as 6 and not incrementally higher
         Sleep(5000);
     }
  
  }


  

Reason: