Download MetaTrader 5

Getting Constantly an Error #2: Common Error - Despite Everything Works Fine?

To add comments, please log in or register
Carl Schreiber
7289
Carl Schreiber  

Hi,

has anybody recognized this 'feature' as well - may as well in mt5 too?

Developing a multi-symbol-system I do:

      ResetLastError();
      int cop1=CopyRates(Sym, PERIOD_M1, 0,3, τRates);
      errCheck = StringFormat("%s cpy:%i ArrSz:%i err:%s",Sym,cop1,ArraySize(τRates),_LastError);

I now I get this if I use CopyRates on any requested symbol:

EURUSD cpy:3 ArrSz:3 err:2 // err#2 = Common Error
whroeder1
15902
whroeder1  
  1. Do not look at _LastError unless you have an error. Cop1 was not -1.
  2. If it fails you have to test for 4066/4073 and retry
  3. Why not use ArrayCopyRates? Once the first call completes successfully, no further calls are necessary and you have access to the entire M1 without copying.
Carl Schreiber
7289
Carl Schreiber  
whroeder1:
Do not look at _LastError unless you have an error. Cop1 was not -1.
Do you mean this for security reasons for Metaquotes and/or the broker as this way they can always say our quotes are correct your code or your connections has some problems (err #2) therefore you are responsible!
whroeder1
15902
whroeder1  
Neither, its probably how the function is coded. It called  function to lookup the the sym/M1 chart, and it had been removed (after 10 minutes of unuse.) So it loaded it from disk, and did its thing. The 2 was left over from internal processing. Meaning less because the function succeeded.
To add comments, please log in or register