Dynamic Arrays in Expert Advisor

 

I know when you are creating a custom indicator, you can create a truly dynamic array to operate as a buffer where you are don't ever have to state its size. 

I was wondering if the same this is possible when creating EAs, currently I get the obvious out of range error with the code below. 

Example code: 

int var_1 [];
var_1[0] = 0;

Thanks in advanced

Step on New Rails: Custom Indicators in MQL5
Step on New Rails: Custom Indicators in MQL5
  • www.mql5.com
I will not list all of the new possibilities and features of the new terminal and language. They are numerous, and some novelties are worth the discussion in a separate article. Also there is no code here, written with object-oriented programming, it is a too serous topic to be simply mentioned in a context as additional advantages for developers. In this article we will consider the indicators, their structure, drawing, types and their programming details, as compared to MQL4. I hope that this article will be useful both for beginners and experienced developers, maybe some of them will find something new.
 

Right now the size of the array is zero, if you want to make it dynamic each time you need to add anything to it or new candle arrives(like indicators) just resize it like this:

ArrayResize(var_1,ArraySize(var_1)+1);
 
No, only buffers auto-resize. Resize them yourself.
 
William Roeder #:
No, only buffers auto-resize. Resize them yourself.
Khuman Bakhramirad #:

Right now the size of the array is zero, if you want to make it dynamic each time you need to add anything to it or new candle arrives(like indicators) just resize it like this:

Thanks, just making sure I wasn't missing anything since resizing makes my code somewhat less intuitive (and maybe my lazy side was hoping as well haha)

Reason: