OPEN-SOURCE SCRIPT

Market Hours Highlight

77
//version=5
indicator("Market Hours Highlight", overlay=true)

// Set your time zone (adjust if needed)
tz = "America/Chicago"

// Define session time for regular market hours (CT)
startTime = timestamp(tz, year, month, dayofmonth, 8, 30)
endTime = timestamp(tz, year, month, dayofmonth, 15, 0)

// Check if current bar is during market hours
isMarketOpen = time >= startTime and time < endTime

// Highlight background only during market open hours
bgcolor(isMarketOpen ? color.new(color.green, 85) : na)

免責聲明

這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。