Download MetaTrader 5

MQL4 process question

To add comments, please log in or register
Ernest Klokow
1119
Ernest Klokow  

If you declared AND initialize some Global and Local Variables, are these variables re-initialized after every cycle reaches return(0) or does it go back to Start() and skips the re-initialization of the variables?

My own opinion is that it does not re-initialize the variables on every cycle - but is that correct?

SYED NAUFAL GADDAFI
1399
SYED NAUFAL GADDAFI  
Yes. Initialization is like a starting point. After that, start() will take over. However, if you want to re-initialized, it is possible though. With some codings of course.
Carl Schreiber
7464
Carl Schreiber  
ernest02:

If you declared AND initialize some Global and Local Variables, are these variables re-initialized after every cycle reaches return(0) or does it go back to Start() and skips the re-initialization of the variables?

My own opinion is that it does not re-initialize the variables on every cycle - but is that correct?


.. it depends.

Please provide a code example for a serious answer.

Ian Venner
2584
Ian Venner  

Initialization of global and static variables is performed once. Initialization of local variables is made every time their function is called.

To add comments, please log in or register