Download MetaTrader 5

Important Update for MetaTrader 4 build 1080 - page 5

To add comments, please log in or register
Tinashe Chipomho
Tinashe Chipomho  

Use custom ArrayCopy for void* Array[].

Here is my two cents code: it is working for me, i simply added ArrayCopy.mqh to my libraries and include it, when it is fixed in MQL i will just remove it.

#property strict

template <typename T> 
int ArrayCopy( T &destination[],  T &source[], const int dstStartIndex = 0, const int srcStartIndex = 0, const int count = WHOLE_ARRAY ){
  const int srcSize = ArraySize(source);
  const int endCopyIndex = (count==WHOLE_ARRAY) ? ArraySize(source) : count;

  ArrayResize(destination, (int)MathAbs(endCopyIndex-srcStartIndex) );
  int copied=0;
  for(int i=srcStartIndex; (i<srcSize)&&(i<endCopyIndex); i++ ){
    destination[dstStartIndex+i] = source[i];  
  return copied;

works when copying to a new destination array, dont use when appending to an existing array, i.e. dstStartIndex > 0

Keith Watford
Keith Watford  
Comments that do not relate to this topic, have been moved to "New MetaTrader 4 Platform build 1090".
To add comments, please log in or register