Originally Posted By: TankWolf
Quote:
BarPeriod = 60; // one-hour-bars
static var WeeklyHigh = 0, WeeklyLow = 0;
if(day(0) != day(5)) { // midnight of day 5 -> week has ended?
WeeklyHigh = HH(120); //(24 hours *5 days)
WeeklyLow = LL(120); //(24 hours *5 days)
}
Because there is no week() function is this how we would find the weekly high & low?

TankWolf, did you see the example I posted? I prefer my method because it's more robust.

* By testing for dow(0) < dow(1), it works even if there are missing days at the start of the week. Or if one broker has Sunday-Friday bars and another has Monday-Saturday bars. (That may not be a problem with Zorro but it is with MT4.)

* Recording the "high and low so far" like I did doesn't rely on there being a specific number of bars per day, or per week. I don't know about Zorro but many platforms can have gaps if your data feed dropped out.