pragma64: i am a beginner
-
Play videoPlease edit your post.
For large amounts of code, attach it. -
int main () {
Unlike C/C++, there is no main in Mql4. Event Handling Functions - Functions - Language Basics - MQL4 Reference datetime start_time="20:00:00"; datetime stop_time="05:00:00";
This will not compile. You can use the literal format (D'20:00:00') if you mean the date of compile. Otherwise you must conversion function StringToTime - Conversion Functions - MQL4 Reference- OVO answered your question. For what you are trying to do, read up on iBarShift and iHighest - Timeseries and Indicators Access - MQL4 Reference
if i want to use iHighest how can i write it in order to the fonction calculate the hightest price of a period ? i mean from 20h to 5h ?
pragma64: if i want to use iHighest how can i write it in order to the fonction
calculate the hightest price of a period ? i mean from 20h to 5h ?
WHRoeder has already answered that (and I quote):
WHRoeder: For what you are trying to do, read up on iBarShift and iHighest - Timeseries and Indicators Access - MQL4 Reference
Use iBarshift() to convert a "date & time" into a "bar-shift" which you can use with the iHighest() which in turn will return another "bar-shift" which you can then use with High[], high[] or iHigh() depending on the case.
Also, please read a related thread of a user with a similar request: https://www.mql5.com/en/forum/159990

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
Hello everybody, i'm french and i am a beginner, i wrote a program and i need help with an error that i don't understand:
int main ()
{
datetime start_time="20:00:00";
datetime stop_time="05:00:00";
MqlRates rates[];
int copied=CopyRates(NULL,0, start_time,stop_time,rates);
if(copied<=0)
Print("Error copying price data ",GetLastError());
else Print("Copied ",ArraySize(rates)," bars");
int maxValueIdx=ArrayMaximum(rates,WHOLE_ARRAY,0);
Print("Max value = ",rates [maxValueIdx]," at index=",maxValueIdx);
int minValueIdx=ArrayMinimum(rates,WHOLE_ARRAY,0);
Print("Min value = ",rates [minValueIdx]," at index=",minValueIdx);
return (0) ;}
error is line 21 and 26 : 'rate'-objects are passed by reference only
thanks for your help