Thanks! But was really hoping to get previous weeks high and low added. Would be the final piece of levels that I would need daily. Thanks!
Code:
input ShowThisWeekOnly = yes;
def CurrentWeek = GetWeek() == GetLastWeek();
def PrevWeekHigh = high(period = "week")[1];
def PrevWeekLow = low(period = "week")[1];
def PrevWeekClose = close(period = "week")[1];
# Conditional plotting for current week only
plot Whigh = if ShowThisWeekOnly and !CurrentWeek then Double.NaN else PrevWeekHigh;
plot Wlow = if ShowThisWeekOnly and !CurrentWeek then Double.NaN else PrevWeekLow;
plot Wmean = if ShowThisWeekOnly and !CurrentWeek then Double.NaN else (PrevWeekHigh + PrevWeekLow + PrevWeekClose) / 3;
Whigh.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
Whigh.SetDefaultColor(Color.UPTICK);
Whigh.SetLineWeight(2);
Wlow.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
Wlow.SetDefaultColor(Color.DOWNTICK);
Wlow.SetLineWeight(2);
Wmean.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
Wmean.SetDefaultColor(Color.YELLOW);
Wmean.SetLineWeight(2);
# Optional: price color changes relative to previous week levels
AssignPriceColor(
if close >= Whigh then Color.GREEN
else if close <= Wlow then Color.RED
else Color.CURRENT
);
Last edited by a moderator: