Trying to color the background of the chart when the time is between a time start and a time end. I've plotted the values of the start and end values I'm trying to use and the time is deffinetly between the values, yet it doesn't plot right. See Screen Shot 1 and 2 Code:
n_monday = (dayofweek(time) == dayofweek.monday)
start_of_mon = n_monday and (ta.barssince(n_monday == false) == 1)
n_sunday = (dayofweek(time) == dayofweek.sunday)
start_of_sun = n_sunday and (ta.barssince(n_sunday == false) == 1)
f_start_monday = (ta.barssince (start_of_sun) == offset) ? true : na
f_monday = ta.valuewhen (f_start_monday, time, 0)
f_start_tuesday = (ta.barssince (start_of_mon) == offset) ? true : na
f_tuesday = ta.valuewhen (f_start_tuesday, time, 0)
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if f_start_monday
label.new (bar_index, 3000, str.tostring (f_monday / 100000))
if f_start_tuesday
label.new (bar_index, 3000, str.tostring (f_tuesday / 100000))
hs_monday = ((time >= f_monday) and (time <= f_tuesday))
bgcolor (hs_monday ? color.blue : na)
I've tried using bar_index instead which doesn't work at all. Rearanging the variables that the last use, rewording them, nothing seems to work, even though time is very clearly between the values given on the labels. (Note I did divide the text on the labels by 100000 for easy reading). Thanks so much for your help in advance!

