Download MetaTrader 5

Array indexing and resizing an AS_SERIES array

To add comments, please log in or register
parham.trader
375
parham.trader  

hi friend,
I've set an array to AS_SERIES indexing by using the ArraySetAsSeries(... ,True) and now I want to resize the mentioned array and add a new element to the very first index - at the extreme right side- of my array. would it be possible to do so? or the only way is that I change it into NORMAL INDEXING style and resize it so that the new index would be located at the extreme right side of the array and the again change the array into AS_SERIES style ?

thanking in advance for your kind guidance,

Alain Verleyen
Moderator
34443
Alain Verleyen  
Why not just try it ?
whroeder1
16808
whroeder1  
Exactly
bool     resize_vector(double& arr[], int nRows, string msg){
   if(ArrayResize(arr, nRows) >= nRows)   return true;
   DisableTrading( "ArrayResize("+nRows+") Failed: "+_LastError + " " + msg);
   return false;
}
bool     resize_buffer(double& buffer[], int nRows, string msg){
   // This enlarges the deque and shifts values B[2]=B[1]; B[1]=B[0]; B[0]=?
   bool     isSeries = ArrayGetAsSeries(buffer);
   ArraySetAsSeries(buffer, !isSeries);
      resize_vector(buffer, nRows, msg);
   ArraySetAsSeries(buffer, isSeries);
   return true;
}
To add comments, please log in or register