Example Chart In the picture above, the left windows is in D timeframe, the right is in 4H timeframe, on the Daily chart only plot the previous 12 days, doesnt plot the vertical lines more than thoses days,on the right chart allow me to plot box shape more than thoses 12 days, but not the lines
//@version=5
indicator("Daily Bias", overlay=true)
// Get the daily open, high, and low prices
dailyOpen = request.security(syminfo.tickerid, "D", open, lookahead=barmerge.lookahead_on)
dailyHigh = request.security(syminfo.tickerid, "D", high, lookahead=barmerge.lookahead_on)
dailyLow = request.security(syminfo.tickerid, "D", low, lookahead=barmerge.lookahead_on)
// Function to check if a new day has started
isNewDay() =>
not na(dailyOpen) and na(dailyOpen[1]) or (dayofweek != dayofweek[1])
// Plot vertical and horizontal lines at the start of each new day
var line hline = na
var line dailyHighline = na
var line dailyLowline = na
var box bearish = na
var box area = na
if isNewDay()
vline = line.new(x1=bar_index, y1=low, x2=bar_index, y2=high, color=color.rgb(109, 114, 117, 70), width=1, extend=extend.both)
hline := line.new(x1=bar_index, y1=dailyOpen, x2=bar_index, y2=dailyOpen, color=color.rgb(68, 163, 218), width=2)
dailyHighline := line.new(x1=bar_index, y1=dailyHigh, x2=bar_index, y2=dailyHigh, color=color.rgb(215, 47, 13), width=1)
dailyLowline := line.new(x1=bar_index, y1=dailyLow, x2=bar_index, y2=dailyLow, color=color.rgb(25, 179, 94), width=1)
area := box.new(bar_index, dailyHigh,bar_index,dailyOpen,border_color = color.new(color.black,90),border_style = line.style_solid )
if isNewDay() == false
line.set_x2(hline, bar_index + 1)
line.set_x2(dailyHighline, bar_index + 1)
line.set_x2(dailyLowline, bar_index + 1)
if close > dailyOpen
box.set_right(area,bar_index + 1)
box.set_top(area, dailyOpen)
box.set_bottom(area, dailyLow)
box.set_bgcolor(area, color = color.new(color.green,70))
if close < dailyOpen
box.set_right(area,bar_index + 1)
box.set_top(area, dailyHigh)
box.set_bottom(area, dailyOpen)
box.set_bgcolor(area, color = color.new(color.red,70))