Custom Session highlighter
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © eSaniello

//@version=5
indicator("Custom Session highlighter", overlay=true)

// highlight trading session background
session_title = input.bool(title = "===========Trading session settings===========", defval = true)
// calc time range to trade in
sessionHours = input.session(defval="1000-1301:1234567", title="Session")
inTradingSession = not na(time(timeframe.period, sessionHours))
bgcolor(color=inTradingSession ? color.new(color.white, 90) : na, title="Trading Hours")
