Download MetaTrader 5
To add comments, please log in or register
Sell your CPU capacity and earn money!
Amir Yacoby
1127
Amir Yacoby 2014.09.24 01:26 

Client Terminal Build and Version (32 or 64 bit)

32 build 701

Problem description

CopyRates simple 2nd variation (by datetime,count) does not work

Sequence of action

Just a simple CopyRates

string sym="GBPUSD";

datetime checkt=D'2014.09.22 04:00:00';

MqlRates rates[2];

int cpy=CopyRates(sym,PERIOD_M1,checkt,2,rates);

result - cpy=-1 last error = 4029 

when I use same CopyClose or CopyTime with this variation (time,count) it's ok. 

Obtained result

error 4029 - array invalid

Expected result

copied 2

Additional details

...

Amir Yacoby
1127
Amir Yacoby 2014.09.24 01:27  

Anyone has some insight as to why these lines don't return rates?

 

string sym="GBPUSD";

datetime checkt=D'2014.09.22 04:00:00';

MqlRates rates[2];

int cpy=CopyRates(sym,PERIOD_M1,checkt,2,rates);
Amir Yacoby
1127
Amir Yacoby 2014.09.24 09:46  

also trying to bypass this by

   int barshiftm1=iBarShift(sym,PERIOD_M1,checkt); 
   int cpy=CopyRates(sym,PERIOD_M1,barshiftm1,2,rates);

 

gives rates of a different time - hope it relates to same issue

whroeder1
13644
whroeder1 2014.09.24 14:22  
amir_avatar: Anyone has some insight as to why these lines don't return rates?
MqlRates rates[2];
Don't give it a size. The function doesn't copy to rates, it redirects accesses to rates to mt4's internal buffer.
Amir Yacoby
1127
Amir Yacoby 2014.09.24 20:20  
WHRoeder:
amir_avatar: Anyone has some insight as to why these lines don't return rates?
Don't give it a size. The function doesn't copy to rates, it redirects accesses to rates to mt4's internal buffer.

Appreciate your intent, even though you haven't tried your suggestion.

Otherwise you would have seen it's not working either (and it can work with rates[2] no problem there, I tried both ways before I posted and [2] works for CopyClose and all other Copy..).

As finally I was able to get response from service desk, this issue is known and should be resolved on next build.
 

Halley
198
Halley 2014.09.25 07:37  

I reported the issue fast a year ago. The service desk answer was like that - do not use time in the parameter, use the bar index which works well.

But this is not the only problem with CopyRates. I sometimes got "access violation error". So finally I am not using this function, but rather ArrayCopyRates and ArrayCopy combo.

Ilyas
1185
Ilyas 2014.09.25 08:54  
amir_avatar:

Client Terminal Build and Version (32 or 64 bit)

32 build 701

Problem description

CopyRates simple 2nd variation (by datetime,count) does not work

Sequence of action

Just a simple CopyRates

string sym="GBPUSD";

datetime checkt=D'2014.09.22 04:00:00';

MqlRates rates[2];

int cpy=CopyRates(sym,PERIOD_M1,checkt,2,rates);

result - cpy=-1 last error = 4029 

when I use same CopyClose or CopyTime with this variation (time,count) it's ok. 

Obtained result

error 4029 - array invalid

Expected result

copied 2

Additional details

...

Thank you for your message. Fixed. Please wait for updates.
Amir Yacoby
1127
Amir Yacoby 2014.09.25 13:07  
DeepThought:

I reported the issue fast a year ago. The service desk answer was like that - do not use time in the parameter, use the bar index which works well.

But this is not the only problem with CopyRates. I sometimes got "access violation error". So finally I am not using this function, but rather ArrayCopyRates and ArrayCopy combo.

At least for ArrayCopyRates it's working now, only after I download the M1 rates manually for the symbol - which I found annoying. I maybe don't do it right.. 
I just go to the M1 chart and scroll it backwards. Isn't there an automatic way to download M1 from within MQL4? 

I don't mean using TickStory and all that.. I know there isn't and the rates are represented different than the MT5 but it's is just a huge drawback in MT4 making me think of go back to MT5 (which for me has a huge drawback in it's position management system.. )
/
To add comments, please log in or register