shift=0; weeklyStartHourBar = iBarShift(Symbol(), PERIOD_H1, iTime(Symbol(),PERIOD_W1,shift), false);
this gives you bar number for hourly bar for current week. iterate shift to specify weekly bar for which you need hourly bar number found.
irusoh1:
this gives you bar number for hourly bar for current week. iterate shift to specify weekly bar for which you need hourly bar number found.
shift=0; weeklyStartHourBar = iBarShift(Symbol(), PERIOD_H1, iTime(Symbol(),PERIOD_W1,shift), false);
this gives you bar number for hourly bar for current week. iterate shift to specify weekly bar for which you need hourly bar number found.
How can I iterate over shift? I could just add one each time but then sometimes the bar is missing. How can I just get the exact time of the bar during the test?
currentTime solves that but it doenst seem to work for me.
I don't quite follow what you are saying. If weekly or hourly bar is missing then
there is something wrong with your data. the exact time of the bar is in
Time[i] for the current chart. That's the time when the bar started.
Time[i] for the current chart. That's the time when the bar started.
I was asking how I could iterate over shift. Do I simply subtract one each time start is called? Then how do I find the initial value of shift? Is there any simple way to know which bar I am currently testing?
I need to go over all the bars during the test
I need to go over all the bars during the test
Alright I have solved it. I didn't realize that while running the EA, the current
bar its testing is 0. I thought 0 would be only the very last bar.
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
each time start function iterates. When I run the test I use the hourly chart period. I run the test from the beginning of 2006 but I always end up with weeklyBar being 0. If I manually enter a date instead of TimeCurrent() I get the proper answer. TimeCurrent() is suppose to be adjusted to the bar during a test correct? If so, why doesn't it work here.