This is valid for you too: https://www.mql5.com/en/forum/305638#comment_24582343
multidimensional array: Out of Range
- 2019.03.05
- www.mql5.com
Dear, I would like to contrast DIs (ADX) with different averaging time frame , so I created a custom Indicator using the basics of ADX Wilder Movin...
You have to specify the amount of buffers the indicator will use, it is working on [0][0] because by default, indicators have 1 buffer, add the following:
#property indicator_buffers 4
Alexandre Borela #:
You have to specify the amount of buffers the indicator will use, it is working on [0][0] because by default, indicators have 1 buffer, add the following:
Thank you very much. I have forgotten the You have to specify the amount of buffers the indicator will use, it is working on [0][0] because by default, indicators have 1 buffer, add the following:
Wish you all a great day! Also thank you for your help!
Array out of bound exception thrown when accessing multidimensional (2d) array inside OnCalculate
- 2021.09.13
- www.mql5.com
Source Code: https://pastebin.com/Tv7BELjw I have met array out of bound exception while accessing 2d-array inside OnCalculate...
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
Source Code:
https://pastebin.com/Tv7BELjw
I have met array out of bound exception while accessing 2d-array inside OnCalculate. But once I changed line 39 to
S[0][0].Data[k] = i * 2 + j;
, that is, access only the (0,0) element, the exception is no longer thrown.
I believe this is a compiler bug or some feature not documented.Reproduce procedure:
Put https://pastebin.com/Tv7BELjw into an indicator and run the indicator.
Change line 39 to S[0][0].Data[k] = i * 2 + j; and rerun the indicator.
Expected behavior:
S[i][j].Data[k] = i * 2 + j; would not throw exception.
Related Topic:
https://www.mql5.com/en/forum/305638