Hello people. I would like to know if there is a way of find the max and min value inside an array who has a variable lenght. I know how to find the max and min in an array with a fixed number of elements, but if the number of them is variable I don't know what function is suitable to use in those cases.
Moreover, I have found nothing about variable lenghts arrays in the book of MQL4 programming.
If somebody knows about this issue and want to tell me where I can find something to read about, I will be very grateful.
- About arrays with variable lenghts
- Write/Read an integer array to file
- [ARCHIVE!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Can't go anywhere without you - 4.
Betowm:
You can't have variable length arrays . . . you can change the size of an array using ArrayResize() but then it's not variable it's fixed to the new size . . . until you resize it. Unless you are talking about Indicator Buffers ?
Hello people. I would like to know if there is a way of find the max and min value inside an array who has a variable lenght. I know how to find the max and min in an array with a fixed number of elements, but if the number of them is variable I don't know what function is suitable to use in those cases.
Moreover, I have found nothing about variable lenghts arrays in the book of MQL4 programming.
If somebody knows about this issue and want to tell me where I can find something to read about, I will be very grateful.
OK. Thank you to both. Another question: if I have a counter that starts to count bars when something is happened (for instance, the volatility increases) Can I use this counter to resizing of the array? Can I, when the counter stops to transfer the counter value to determine the size of the array where I want to determine the MAX and MIN values? Thank you in advance for your kindness in responding me.
Betowm:
OK. Thank you to both. Another question: if I have a counter that starts to count bars when something is happened (for instance, the volatility increases) Can I use this counter to resizing of the array? Can I, when the counter stops to transfer the counter value to determine the size of the array where I want to determine the MAX and MIN values? Thank you in advance for your kindness in responding me.
OK. Thank you to both. Another question: if I have a counter that starts to count bars when something is happened (for instance, the volatility increases) Can I use this counter to resizing of the array? Can I, when the counter stops to transfer the counter value to determine the size of the array where I want to determine the MAX and MIN values? Thank you in advance for your kindness in responding me.
I'm not 100% certain what you are asking . . . lets see if I can answer anyway . . . if you want to add another value to your array and it isn't big enough you can do this . . .
double MyArray[], ValueToAddToArray; // I want to add a value to the array // first increase the size of the array by one cell ResizeArray(MyArray, ArraySize(MyArray) + 1); // now write the value into the new last cell of the array MyArray[ArraySize(MyArray) - 1] = ValueToAddToArray;
Thank you for responding me RaptorUK. The fact is this: The array start when the volatility exceed certain value. The counter begins. When the volatility decreases below of some value the counter stops counting and finds the MAX and the MIN value into that array. This is what I need to know how to do. It seems to me that your previous explanation helps me. Only must I think more about it...
Betowm:
Thank you for responding me RaptorUK. The fact is this: The array start when the volatility exceed certain value. The counter begins. When the volatility decreases below of some value the counter stops counting and finds the MAX and the MIN value into that array. This is what I need to know how to do. It seems to me that your previous explanation helps me. Only must I think more about it...
Set the array size at 0, when the "volatility" exceeds a certain value add one to the array size and save the value to the array, repeat this for each value you want to save . . . when the "volatility" decreases you can get the max and min values from the array using ArrayName[ArrayMaximum(ArrayName)] and ArrayName[ArrayMinimum(ArrayName)]
Thank you for responding me RaptorUK. The fact is this: The array start when the volatility exceed certain value. The counter begins. When the volatility decreases below of some value the counter stops counting and finds the MAX and the MIN value into that array. This is what I need to know how to do. It seems to me that your previous explanation helps me. Only must I think more about it...
YES !! exactly how you say !! Thank you RaptorUK you are great ! :-)
Betowm:
Happy to help
YES !! exactly how you say !! Thank you RaptorUK you are great ! :-)
Please help me, I 've to code this formula :
formula = close - Average[100](close)
max = highest[10](formula)
thank you in advance.
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