I try below code for Week Open Price on Indicator. I have not any error code but below code does not shows me correct time.
if(TimeDayOfWeek(Time[i]) != TimeDayOfWeek(Time[i+1]))
Any help would be better.
Thanks for your reply.
I use below code for Day Open Price.
if(TimeDay(Time[i]) != TimeDay(Time[i+1]))
It does work for me. Even Month and Year, but Week is not.
Your code asks if bar i is the start of a new day not a new week. You want to find the "Week Open Price," here are three ways:
double wop = iOpen(NULL, PERIOD_W1, 0)
datetime BOW = iTime(NULL, PERIOD_W1, 0);
int iBOW = iBarShift(NULL,0, BOW);
double wop = Open[iBow];
while( TimeDayOfWeek(Time[i]) >= TimeDayOfWeek(Time[i+1]) ) ++i;
double wop = Open[i];
That was awesome. Yeah, I found what I want. Thank you so much - @WHRoeder
Everything OK at any TimeFrames. But indicator Opened wrong Price & Time when I want to use it at the "W1 / Weekly" TimeFrame.
To add comments, please log in or register