I am newbie, please help! 2 question: a- why I receive Array out of range on this code? b-how to code to get the last error code on this script? Thank you in advance for your help !!!!
void OnStart() { double buffer[]; //SetIndexBuffer(0, buffer); if (ArrayResize(buffer, 5) != -1) { // 5 as example buffer[2]=11; } else { Print("Error : ", GetLastError()); } }SetIndexBuffer is for use in indicator not with a script.
Thank you!
But I receive the same error in an indicator . I extracted the code I posted from its code to be not so complicated, that is why I used SetIndecBuffer (because in indicator was it)
And ArrayResize() is not for static arrays?
Thank you!
But I receive the same error in an indicator . I extracted the code I posted from its code to be not so complicated, that is why I used SetIndecBuffer (because in indicator was it)
And ArrayResize() is not for static arrays?
A static array is...static :-D you can't resize it. See documentation.
Please note that you can't change the size for dynamic arrays set as indicator buffers by the function SetIndexBuffer(). For indicator buffers, all operations of size changes are performed by the executing sub-system of the terminal.
If you use SetIndexBuffer in an indicator, then you can't resize it.
It's better to show you indicator code if you need help.
I have to delete your post, this is decompiled code. Don't decompile someone else code.
I am in shock that MQL5 compiled file may be decompiled already.
This is not MQL5, this is MQL4. He took MQL4 decompiled code and try to convert it to MQL5.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I am newbie, please help! 2 questions: a- why I receive "Array out of range" error message window when I run/debug this code? b-how to code to get the last error code on this script? Thank you in advance for your help !!!!