Hi guys,
I'm very new in MQL and I only know 2 ways to save information in an running indicator :
- global variable, defined at the same level of functions and which can be set only once
- buffer which depends of the number of Bars
My question is : Is there another way in MQL to keep information at the "indicator level" which can be set several times ?
For example : a global array resizable that does not depend of Bars (like buffers).
I think I can use some tricks with multiple buffers to bypass this limitation but I want to be sure before using these.
I hope I've been clear, English not being my native tongue...
Thanks in advance :)
You can have up to 8 buffers in an indicator, they don't all have to show. Beyond that you have to manage your own arrays.
Perhaps you should explain why you think you need another method.
You can use arrays in an Indicator if you want . . . and make them bigger or smaller as you wish.
If I define an array in the Indicator scope, it is considered as a global variable and the doc says : "A global variable can be initialized only by a constant that corresponds with its type. Global variables can be initialized only once after program loading into client terminal memory."
These are the two aspects I want to avoid :(
You can also change values in an Indicator buffer for any bar you like . . .
You can have up to 8 buffers in an indicator, they don't all have to show. Beyond that you have to manage your own arrays.
Perhaps you should explain why you think you need another method.
I'm exploring MQL possibilities, so it's a general thought, no ideas in particular...
Here an example anyway : let's imagine you want to keep a list of values and depending of some results in the indicator, you want to add or delete some of these.
How do you do that without buffers ?
Otherwise, how do you manage your own arrays ?
If I define an array in the Indicator scope, it is considered as a global variable and the doc says : "A global variable can be initialized only by a constant that corresponds with its type. Global variables can be initialized only once after program loading into client terminal memory."
These are the two aspects I want to avoid :(
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi guys,
I'm very new in MQL and I only know 2 ways to save information in an running indicator :
- global variable, defined at the same level of functions and which can be set only once
- buffer which depends of the number of Bars
My question is : Is there another way in MQL to keep information at the "indicator level" which can be set several times ?
For example : a global array resizable that does not depend of Bars (like buffers).
I think I can use some tricks with multiple buffers to bypass this limitation but I want to be sure before using these.
I hope I've been clear, English not being my native tongue...
Thanks in advance :)