Update Array

 

Hi. I'm currently working on my first EA and I have grown pretty desprate. I actually want to fill my array[0] with the recent indicator value and have the previouse value move to array[1].


void OnTick()

  {

   if(OrdersTotal()>1) return;

   

   double arr[2]= {0.0, 0.0};

   

   for(int i= 0; i < 1000; i++){

   double zigZag = iCustom(_Symbol, PERIOD_CURRENT,"ZigZag",0,i);

   if(zigZag != EMPTY_VALUE && zigZag != 0)

      {if(arr[0] == 0){arr[0] = zigZag;}

      else if(arr[1] == 0) {arr[1] = zigZag;}}

   }

I tried ArrayResize as an else if statemant if the value is >=1 but it only equalized the array values. 

I also tried ArrayFree to no success. Is there anything I could do? 


Help would be much appreciated

 
Please edit your post and use the code button (Alt+S) when pasting code.
EDIT your original post, please do not just post the code correctly in a new post.

Reason: