I have a few questions...
Do I have to use a cycle to get access the past bars or is the function ArrayMaximum all that is needed?
Also if someone could provide an example it would be appreciated..
ArrayMaximum will work. Just remember it returns the index with the highest value, not the actual value.
Examples in the documentation (easier to follow in the MT4 documentation):

- docs.mql4.com
ArrayMaximum will work. Just remember it returns the index with the highest value, not the actual value.
Examples in the documentation (easier to follow in the MT4 documentation):
the example provides a set array with constant values called num_array:
void OnStart()
{
//---
double num_array[15]={4,1,6,3,19,4,2,6,3,9,4,5,6,3,9};
int maxValueIdx=ArrayMaximum(num_array,WHOLE_ARRAY,0);
Print("Max value = ",num_array[maxValueIdx]," at index=",maxValueIdx);
}
I've tried replacing num_array with my buffer and there was no result.
What could I be doing wrong?
the example provides a set array with constant values called num_array:
void OnStart()
{
//---
double num_array[15]={4,1,6,3,19,4,2,6,3,9,4,5,6,3,9};
int maxValueIdx=ArrayMaximum(num_array,WHOLE_ARRAY,0);
Print("Max value = ",num_array[maxValueIdx]," at index=",maxValueIdx);
}
I've tried replacing that with my buffer and there was no result.
What could I be doing wrong?
You'll need to post up your code.
the example provides a set array with constant values called num_array:
void OnStart()
{
//---
double num_array[15]={4,1,6,3,19,4,2,6,3,9,4,5,6,3,9};
int maxValueIdx=ArrayMaximum(num_array,WHOLE_ARRAY,0);
Print("Max value = ",num_array[maxValueIdx]," at index=",maxValueIdx);
}
I've tried replacing num_array with my buffer and there was no result.
What could I be doing wrong?
What do you mean that there was no result. The print must have printed something or the code is not being executed.
Please use the SRC button when posting code. I have done it for you this time.
What do you mean that there was no result. The print must have printed something or the code is not being executed.
Please use the SRC button when posting code. I have done it for you this time.
What do you mean that there was no result. The print must have printed something or the code is not being executed.
honest_knave:
ArrayMaximum will work. Just remember it returns the index with the highest value, not the actual value. Examples in the documentation (easier to follow in the MT4 documentation):
That is the section of code I'm having trouble with.. I don't post my entire code it is not for the world..
Also, if you expect help you need to post at least some of your code i.e. the section you are having trouble with.
Posting up the example from the help files is no use - the example code works so there must be a problem with your implementation.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I have a few questions...
Do I have to use a cycle to get access the past bars or is the function ArrayMaximum all that is needed?
Also if someone could provide an example it would be appreciated..