HERES MY pine script code: //@version=5
indicator("Previous Week Bias", overlay=true, max_labels_count=1, max_lines_count=1)

var line prevWeekHighLabel = na
var line prevWeekLowLabel = na
var line buySignalLine = na
var line sellSignalLine = na
var line buy00Line = na
var line sell00Line = na
var line buy007Line = na
var line sell007Line = na
var label buy007Label = na
var label sell007Label = na

var float prevMonthHigh = na
var float prevMonthLow = na
var float fiftyPercent = na
var float highestHigh = na
var float lowestLow = na
var bool buyBiasConfirmed = na
var bool sellBiasConfirmed = na
var bool redCandleClosed = na
var bool greenCandleClosed = na
var float buy00Price = na
var float sell00Price = na

prevMonthHigh := request.security(syminfo.tickerid, "M", high[1])
prevMonthLow := request.security(syminfo.tickerid, "M", low[1])
fiftyPercent := (prevMonthHigh + prevMonthLow) / 2
prevWeekCloseHigh = request.security(syminfo.tickerid, "W", high[1])
prevWeekCloseLow = request.security(syminfo.tickerid, "W", low[1])
prevWeekClose = request.security(syminfo.tickerid, "W", close[1])
high4H = request.security(syminfo.tickerid, "240", high)
low4H = request.security(syminfo.tickerid, "240", low)
close4H = request.security(syminfo.tickerid, "240", close)
open4H = request.security(syminfo.tickerid, "240", open)

if ta.change(time("W")) > 0
    line.delete(prevWeekHighLabel)
    line.delete(prevWeekLowLabel)
    line.delete(buySignalLine)
    line.delete(sellSignalLine)
    line.delete(buy00Line)
    line.delete(sell00Line)
    line.delete(buy007Line)
    line.delete(sell007Line)
    label.delete(buy007Label)
    label.delete(sell007Label)

    if prevWeekClose > fiftyPercent
        prevWeekHighLabel := line.new(x1=bar_index[1], y1=prevWeekCloseHigh, x2=bar_index, y2=prevWeekCloseHigh, color=color.blue, width=1, style=line.style_solid)
        label.new(x=bar_index, y=prevWeekCloseHigh, text="Buy Bias", color=color.green, style=label.style_text_outline, size=size.small)
        buyBiasConfirmed := true
    else if prevWeekClose < fiftyPercent
        prevWeekLowLabel := line.new(x1=bar_index[1], y1=prevWeekCloseLow, x2=bar_index, y2=prevWeekCloseLow, color=color.blue, width=1, style=line.style_solid)
        label.new(x=bar_index, y=prevWeekCloseLow, text="Sell Bias", color=color.red, style=label.style_text_outline, size=size.small)
        sellBiasConfirmed := true

// Buy bias logic
if buyBiasConfirmed
    if (close4H) > prevWeekCloseHigh
        high4H := buy00Price
    else if high4H > buy00Price
        high4H := buy00Price
    else if (close4H) < open4H
        redCandleClosed := true
    else if redCandleClosed and not na(buy00Price)
        buy007Line := line.new(x1=bar_index, y1=buy00Price, x2=bar_index, y2=buy00Price, color=color.rgb(0, 21, 249), width=1, style=line.style_solid)
        label.new(x=bar_index, y=buy00Price, text="Buy 00=7", color=color.green, style=label.style_text_outline, size=size.small)
        redCandleClosed := na

// Sell bias logic
if sellBiasConfirmed
    if (close4H) < prevWeekCloseLow 
        sell00Price := low4H
    else if low4H < sell00Price
        sell00Price := low4H
    else if (close4H) > open4H 
        greenCandleClosed := true
    else if greenCandleClosed and not na(sell00Price)
        sell007Line := line.new(x1=bar_index, y1=sell00Price, x2=bar_index , y2=sell00Price, color=color.rgb(10, 36, 205), width=1, style=line.style_solid)
        label.new(x=bar_index, y=sell00Price, text="Sell 00=7", color=color.red, style=label.style_text_outline, size=size.small)
        greenCandleClosed := na

if ta.change(time("W")) > 0
    line.delete(prevWeekHighLabel)
    line.delete(prevWeekLowLabel)
    line.delete(buySignalLine)
    line.delete(sellSignalLine)
    line.delete(buy00Line)
    line.delete(sell00Line)
    line.delete(buy007Line)
    line.delete(sell007Line)
    label.delete(buy007Label)
    label.delete(sell007Label)
can you help me stop it from making new lines and labels every 4h candle. i only want each time to occur once per week (but still to be drawn on 4h timeframe)(if at all in case of 00, 00=7). can you also make it so the lines drawn extend 5 candes out from the current candle regardless of what time frame. make sure no duplicate line/labels print per week