Ok I think I managed to solve my problem. I change the code below: -
a = box.new(bar_index[1]+ 6, ta.highest(sl, 1), bar_index[1]+ 12, ta.lowest(Price, 1), color.white, 1, line.style_solid, extend.none, xloc.bar_index, color.new(color.red, 60)) b = box.new(bar_index[1]+ 6, ta.highest(Price, 1), bar_index[1]+ 12, ta.lowest(take_profit, 1), color.white, 1, line.style_solid, extend.none, xloc.bar_index, color.new(color.lime, 60))
to
a = box.new(bar_index[1]+ 6, ta.highest(sl, 1), bar_index[1]+ 12, ta.lowest(Price, 1),force_overlay = false, border_color = color.white, border_style = line.style_solid, bgcolor = color.new(color.red, 60)) b = box.new(bar_index[1]+ 6, ta.highest(Price, 1), bar_index[1]+ 12, ta.lowest(take_profit, 1),force_overlay = false, border_color = color.white, border_style = line.style_solid, bgcolor = color.new(color.lime, 60))
making use of "force_overlay = true