-
Always use strict. Fixing the warnings will save you hours of debugging, but you must understand the differences.
-
for (shift = limit; shift > 1; shift--) { ArrayResize(FastUp,shift,1000); ArrayResize(FastDn,shift,1000); FastUp[shift] = 0.0;
Why are you resizing the arrays inside the loop? - You sized the array to shift. That means you have indexes [0 … shift-1]. Why does the access failure surprise you?
William Roeder #:
-
Always use strict. Fixing the warnings will save you hours of debugging, but you must understand the differences.
- Why are you resizing the arrays inside the loop?
- You sized the array to shift. That means you have indexes [0 … shift-1]. Why does the access failure surprise you?
Yes, I always use strict.
It doesn't have to be inside the loop, I just tried it that way too.
shift = limit; that is the size of the array, and I want to get started from the last , instead of from the beginning.
for (shift = limit; shift > 1; shift--)
I don't see where I'm wrong, maybe you can point me to a mistake?
In this example ArrayResize - Array Functions - MQL4 Reference
the arrays is inside the loop.
![ArrayResize - Array Functions - MQL4 Reference ArrayResize - Array Functions - MQL4 Reference](https://c.mql5.com/36/51/arrayresize-array-functions-mql4.png)
ArrayResize - Array Functions - MQL4 Reference
- docs.mql4.com
ArrayResize - Array Functions - MQL4 Reference
Somehow I managed to come to a solution:
for (shift = limit-1; shift > 1; shift--)
Thank you William Roeder
![William Roeder William Roeder](https://c.mql5.com/36/51/william-roeder.png)
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
If I enable #property strict, then the loop behaves differently.
I got error: array out of range in 'Fast.mq4' (44,13)
If I change the for loop in
Its works ok, but I don want it to work on that way, I need:
And that not work if this is enabled