English

## Week Open Price for indicator

 37 Max-Enrik 2016.05.29 14:40   Hi,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.Best,Max
 37 Max-Enrik 2016.05.29 15:30 #   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. Thanks,Max
 13009 WHRoeder 2016.05.29 16:14 #   Max-Enrik: 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]))`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];```Find the first bar of the new week: the DOW(Monday) < DOW(Friday)```int i=0; while( TimeDayOfWeek(Time[i]) >= TimeDayOfWeek(Time[i+1]) ) ++i; double wop = Open[i];```
 37 Max-Enrik 2016.05.29 17:04 #   WHRoeder:```int i=0; 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 - @WHRoederEverything OK at any TimeFrames. But indicator Opened wrong Price & Time when I want to use it at the "W1 / Weekly" TimeFrame.Best,Max