double nodes[];
Your array has no size. You must resize it before updating elements.
Perhaps you should read the manual. ArrayResize
How To Ask Questions The Smart Way. (2004)
How To Interpret Answers.
RTFM and STFW: How To Tell You've Seriously Screwed Up.
Thanks William,
I was guided by this:
"The function (ArrayResize) can be applied only to dynamic arrays. It should be noted that you cannot change the size of dynamic arrays assigned as indicator buffers by the SetIndexBuffer() function. For indicator buffers, all operations of resizing are performed by the runtime subsystem of the terminal."
But I'll get back to reading about SetIndexBuffer...
Dynamic Array Object - Data Types - Language Basics - MQL4 Reference
- docs.mql4.com
Dynamic Array Object - Data Types - Language Basics - MQL4 Reference
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
Hi everyone!
I'm trying to figure out how MQL4 arrays work and I stumbled upon a behavior I don't understand.
I want an array to hold some undetermined number of elements so I figure out that I should use SetIndexBuffer to let the platform handle it's size.
While I can see the elements printed in OnInit function, when I print them again in OnCalculate I see there are all zeroes.
What am I missing?
Thanks in advance!