The answer is here https://docs.mql4.com/series
double iLow( string symbol, int timeframe, int shift) double iOpen( string symbol, int timeframe, int shift) double iClose( string symbol, int timeframe, int shift) double iHigh( string symbol, int timeframe, int shift)
and the shift can be found based on time
int iBarShift( string symbol, int timeframe, datetime time, bool exact=false)
and time can be found from string by
datetime StrToTime( string value)
where string can be in the form
"2003.8.12 17:35" "17:35"
The answer is here https://docs.mql4.com/series
and the shift can be found based on time
and time can be formed drom string by
where string can be in the form
how can i use this in a loop? Example the for loop where i=0 'start time'
please check if the looping that i used is right
int start(Symbol(), PERIOD_D1, StrToTime("2013.2.1 00:00"), bool exact=false); int end(Symbol(), PERIOD_D1, StrToTime("2013.2.28 24:00"), bool exact=false); while(start!=end) { double iOpen( Symbol(), PERIOD_D1, start); start++; Alert("",iOpen); }
will it work if i want to obtain the iOpen value every hour? because i am not sure about the timeframe on how to use it.
int start = iBarShift(NULL,PERIOD_H1, StrToTime("2013.2.1 00:00")); int end = iBarShift(NULL,PERIOD_H1, StrToTime("2013.2.28 23:59")); for(int i=start; i>=end; i--) { Alert(iOpen(NULL,PERIOD_H1,i)); }
please check if the looping that i used is right
will it work if i want to obtain the iOpen value every hour? because i am not sure about the timeframe on how to use it.
You are along the right lines . . but you also have some problems . . . you want to use H1 ? but you are using PERIOD_D1 which is D1, use PERIOD_H1
You need to use iBarShift() to get the bar numbers for start and end . . . 24:00 is not a valid time . . . 00:00 is midnight 23:00 is the hour bar before midnight
Bars are counted from the current bar which is zero towards the left, so the bar to the left of the currently forming bar is bar 1, then 2, 3, 4, etc. so you need to go from end to start if you are counting up, end++ or from start to end if you count down start--
Keep going . . . or don't and cyberfx.org will write your code for you.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello everyone...
Is anyone have an example on how you can access OPEN, HIGH, LOW, CLOSE based on a time? for example i want to access the values of a certain symbols from 00:00:00 to 24:00:00 which mean one day. I already looked at the documentation but i have no success. And how will you set it for a certain date...
Thank you very much..