Highlight Day of Week
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// A simple indicator that highlights certain days of the week by changing the background color of the chart to a specified color.
// Each day can be highlighted its own respective color.
// © SyedMehdi
//@version=5
indicator('Highlight Day of Week', overlay=true)


highlightMon = input.bool(true, 'Monday', inline='Monday')
colorMon = input.color(color.new(color.yellow, 50), '', inline='Monday')
highlightTues = input.bool(true, 'Tuesday', inline='Tuesday')
colorTues = input.color(color.new(color.yellow, 60), '', inline='Tuesday')
highlightWed = input.bool(true, 'Wednesday', inline='Wednesday')
colorWed = input.color(color.new(color.yellow, 70), '', inline='Wednesday')
highlightThurs = input.bool(true, 'Thursday', inline='Thursday')
colorThurs = input.color(color.new(color.yellow, 80), '', inline='Thursday')
highlightFri = input.bool(true, 'Friday', inline='Friday')
colorFri = input.color(color.new(color.yellow, 90), '', inline='Friday')

var bool timeIsWM = timeframe.isweekly or timeframe.ismonthly

bgColor = if not timeIsWM
    dayofweek == dayofweek.monday and highlightMon ? colorMon : dayofweek == dayofweek.tuesday and highlightTues ? colorTues : dayofweek == dayofweek.wednesday and highlightWed ? colorWed : dayofweek == dayofweek.thursday and highlightThurs ? colorThurs : dayofweek == dayofweek.friday and highlightFri ? colorFri : na
else
    na

bgcolor(color=bgColor)

