ArrayCopyRates(mqlrates_array_15,NULL,PERIOD_M15);Check your return codes and you would know why. What are Function return values ? How do I use them ? - MQL4 forum and Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles 4066, sleep, refreshRates and retry
Check your return codes and you would know why. What are Function return values ? How do I use them ? - MQL4 forum and Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles 4066, sleep, refreshRates and retry
Thanks a lot for you replay . I have checked return values of ArrayCopyRates but the result confuses me.
If I use ArrayCopyRates for H1 bars I receive return value of 2098 elements copied. But if I am running EA with tick counter - I will go out of range after 187 ticks?
Also - so to avoid going out of range do I need to keep resizing my mqlrates arrays?
I have attached code with my recent changes
Print(counter, ":60 mins Rates time: ", mqlrates_array_60[counter].time);
- What does ticks have to do with bars. After one tick you look back one hour. After 24 ticks you look back 24 hours. Bogus.
- You do not resize your arrays, after calling ACR successfully, they will auto-update.
- What does ticks have to do with bars. After one tick you look back one hour. After 24 ticks you look back 24 hours. Bogus.
- You do not resize your arrays, after calling ACR successfully, they will auto-update.
I used tick to check how far I can go and I was expecting to reach 2098 elements of H1 mqlrates (so 2098 hours) - but it went out after 187 elements.
Anyway - so problem is with wrong way of calling ACR function?,
does it mean I am copying array instead of passing it by reference?
I used code from https://docs.mql4.com/array/arraycopyrates - and I though it is way to use it.
- docs.mql4.com
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello
I am trying to understand why in example below my EA stops and I receive array out of range error (pointing that problem is in following line:
Print( "15 mins Rates time: ", mqlrates_array_15[0].time);
My entire idea is to be able to refer to MqlRates of different timeframes of the same symbol.
The EA runs for some time and then crashes.
Can anyone help please?