Highlight Trading Window (Simple Hours / Time of Day Filter)
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © ddctv

//@version=5
indicator("Highlight Trading Window (Simple Hours / Time of Day Filter)", overlay=true)

//////////////////////////////
// LIMIT TIME OF DAY WINDOW //
//////////////////////////////

transparency    = 90 // input.int(title="Time Filter background transparency", defval=95)
gmtSelect       = input.string(title="Select Local Time Zone", defval="GMT-8", options=["GMT-12","GMT-11","GMT-10","GMT-9","GMT-8","GMT-7", "GMT-6", "GMT-5", "GMT-4", "GMT-3", "GMT-2", "GMT-1", "GMT", "GMT+1", "GMT+2",	"GMT+3","GMT+4","GMT+5","GMT+6","GMT+7","GMT+8","GMT+9","GMT+10","GMT+11","GMT+12","GMT+13","GMT+14"], confirm=true, group="Limit Time of Day Window")
// === INPUT TIME RANGE ===
betweenTime     = input.session('0700-0900',  title = "Time Filter", group="Limit Time of Day Window")   // '0000-0000' is anytime to enter

isTime(_position) =>                                                      // create function "within window of time"
    isTime      = na(time(timeframe.period, _position + ':1234567', gmtSelect))               // current time is "within window of time"
    
bgcolor(color = isTime(betweenTime) ? na : color.new(color.green,transparency))
