Hi coders, being a beginner and no programming background, I tried to understand and learn the Array coding, I wrote two methods of getting the Longest Green Bar Value :-
1) Ended up with 64 errors and 16 warnings :-
2) No error at all but with a message "array out of range (3996,10)"
FYI, I have read the https://docs.mql4.com/array/arraymaximum but don't understand how to write correct codes.
Secondly, how about any ways to get the second and third longest green bars values ?
Could you please advise and correct my mistake and tell me where I went wrong, thanks.
1) Ended up with 64 errors and 16 warnings :-
Inserted Code
double mxGrn[]; // To get Longest Green Bar Value
for(int i=5; i<=20; i++)
{
mxGrn[i]=ArrayMaximum(iClose(Symbol(),60,i)-iOpen(Symbol(),60,i),20-5+1,i)
}
Print("Longest Green Bar Value : ",mxGrn); 2) No error at all but with a message "array out of range (3996,10)"
Inserted Code
double grnBar[];
double mxGrn=0; // To get Longest Green Bar Value
for(int i=5; i<=20; i++)
{
grnBar[i]=iClose(Symbol(),60,i)-iOpen(Symbol(),60,i);
mxGrn=grnBar[ArrayMaximum(grnBar,WHOLE_ARRAY,i)];
}
Print("Longest Green Bar Value : ",mxGrn); FYI, I have read the https://docs.mql4.com/array/arraymaximum but don't understand how to write correct codes.
Secondly, how about any ways to get the second and third longest green bars values ?
Could you please advise and correct my mistake and tell me where I went wrong, thanks.