getting hourly range in a day and over x days
Hi all,
I need to get the hourly range High - Low of a day and over x days.
I written a sample to get daily range, how do I modify to get hourly range for a day and over x days?
Use the barshift function to get information about a specific bar
- Dua Yong Rew: I written a sample to get daily range, how do I modify to get hourly range for a day and over x days?
Why not just call iATR?
- Dua Yong Rew: I need to get the hourly range High - Low of a day and over x days.
That you have to code yourself.
Find bar of the same time one day ago - MQL4 programming forum #1 & #6 (2017)Not tested, not compiled, just typed.
double ave_range_hour(int count, int hour){ datetime when = date() + hour*PeriodSeconds(PERIOD_H1); double sum=0; int n=0; while(n < count){ int iBar=iBarShift(_Symbol, PERIOD_H1, when, true); if(iBar >= 0)){ sum += iHigh(_Symbol, PERIOD_H1, iBar) - iLow(_Symbol, PERIOD_H1, iBar); ++n; } when -= PeriodSeconds(PERIOD_D1); } return sum / count; }
Not tested, not compiled, just typed.
-
Why not just call iATR?
-
That you have to code yourself.
Find bar of the same time one day ago - MQL4 programming forum #1 & #6 (2017)Not tested, not compiled, just typed.
Not tested, not compiled, just typed.
I am also trying to find the same indicator.
Hi all,
I need to get the hourly range High - Low of a day and over x days.
I written a sample to get daily range, how do I modify to get hourly range for a day and over x days?