Support needed: confused about some ArrayCopySeries() test results

 

I learn about ArrayCopySeries() with code below.

Attached text file is collection of printed results from a few runs of script.

.hst files for various symbol/period deleted before tests.

Problem is over the results which can be inconsistent, as if system has problem?

Look at attached file please - even take code into script and see for self.

One thing I learn is smaller Sleep() times makes for faster results. I mean that say first call gets 4066, so Sleep(ms); then retry and maybe more Sleep(ms); retry loops. If big ms maybe system finish fast but EA must finish Sleep(big ms); and time wasted. If small ms maybe few extra retrys but total Sleep(small ms); is less. You test - is maybe of interest for you also.

#include <stderror.mqh> 
#include <stdlib.mqh>

#property show_inputs
extern string sym="USDSEK";
extern int period=PERIOD_M1;
extern int shift=1024;
extern int ms=50;

int start()
{
  int i,err,err1,err2,msStart;
  datetime dt;
  double _Open[],d;

  Print("Start StopWatch"); msStart=GetTickCount();
  for(i=1;i<=10;i++) {
    ArrayCopySeries(_Open,MODE_OPEN,sym,period); err1=GetLastError();
    Print("TRY.",i," ArrayCopySeries(_Open,MODE_OPEN,",sym,",",period,"), ArrayCopySeries()=",err1,"=",ErrorDescription(err1));
    d=iOpen(sym,period,shift); err2=GetLastError();
    Print("TRY.",i," MappedSeriesArray _Open[",shift,"]=",_Open[shift],", Call iOpen(",sym,",",period,",",shift,")=",d,", iOpen()=",err2,"=",ErrorDescription(err2));
    if(err1+err2==0)break;
    Sleep(ms);
  }
  if(i<=10) Print("ArrayCopySeries() success takes ",i," TRYs, total Sleep(",ms,")=",(i-1)*ms,"ms");
  else Print("ArrayCopySeries() failure takes ",i," TRYs, total Sleep(",ms,")=",(i-1)*ms,"ms");
  dt=MarketInfo(sym,MODE_TIME); err=GetLastError(); Print("MarketInfo(",sym,",MODE_TIME)=",TimeToStr(dt,7),", Error=",err,"=",ErrorDescription(err));
  d=MarketInfo(sym,MODE_LOW);      err=GetLastError(); Print("MarketInfo(",sym,",MODE_LOW)=",d, ", Error=",err,"=",ErrorDescription(err));
  d=MarketInfo(sym,MODE_HIGH);  err=GetLastError(); Print("MarketInfo(",sym,",MODE_HIGH)=",d,", Error=",err,"=",ErrorDescription(err));
  d=MarketInfo(sym,MODE_BID);      err=GetLastError(); Print("MarketInfo(",sym,",MODE_BID)=",d, ", Error=",err,"=",ErrorDescription(err));
  d=MarketInfo(sym,MODE_ASK);      err=GetLastError(); Print("MarketInfo(",sym,",MODE_ASK)=",d, ", Error=",err,"=",ErrorDescription(err));
  Print("StopWatch=",GetTickCount()-msStart,"ms");
  return(0);
}
 

question answered. I find out that when symbol added to Market Watch Window retry loop still happens but ok result happen in the end.

I doing multi symbol/period EA and that is why I ask for support - unable get data many symbols - but is ok now.

Now I know how get results.

thanks me - lol