DarioSoltani

Trading hours background highlight UTC based

Highlights trading opening hours in the background based on UTC times.
Settings for US and EU markets available now, let me know if you want other markets.
Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.

Want to use this script on a chart?
//
// @author DarioSoltani
// https://www.tradingview.com/u/DarioSoltani/
//
// If you use this code in its original/modified form, do drop me a note. 
//
// This script highlights trading hours for different markets in the background

study(title="Trading hours background highlight UTC based", shorttitle="Trading hours", overlay=true)
timeinrange(res, sess) => time(res, sess) != 0

showUS = input(defval=true, type = bool, title="NY Session On")
tradeHoursUS = input(title="Trade hours US", type=session, defval="1330-2100")
sessionUS = lime

showEU = input(defval=true, type = bool, title="Euro Session On")
tradeHoursEU = input(title="Trade hours Europe", type=session, defval="0800-1630")
sessionEU = navy

bgcolor(showUS and timeinrange(period, tradeHoursUS) ? sessionUS : na, transp=95)
bgcolor(showEU and timeinrange(period, tradeHoursEU) ? sessionEU : na, transp=95)