How To Calculate Symbol's UTC Number
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © allanster

//@version=5
indicator("How To Calculate Symbol's UTC Number", overlay = true)

// Various methods to calculate a symbol's timezone offset as a numerical value in hours and decimal minutes. This value
// may be useful to script authors in certain situations where timezone information needs to be available in a numerical
// format while using intraday charts. Special thanks to @LucF and TradingView Support for their efficiency advisements!


tickerID = input.symbol('NSE:CESC')


// === EXAMPLE SINGLE SECURITY REQUEST ===
f_UTC(_tickerID) =>  // returns called symbol's UTC+/-Hour.Minutes
    request.security(_tickerID, timeframe.period, 
     dayofweek <= dayofweek(time_tradingday, syminfo.timezone) ?
     hour(time_tradingday, syminfo.timezone) + minute(time_tradingday, syminfo.timezone) / 60 :
     hour(time_tradingday, syminfo.timezone) - 24 - minute(time_tradingday, syminfo.timezone) / 60)
UTC = f_UTC(tickerID)


// === EXAMPLE SINGLE SECURITY REQUEST USING TUPLES ===
f_requestVars() =>  // specify variables to request from called symbol's 
    [dayofweek,
     dayofweek(time_tradingday, syminfo.timezone),
     hour     (time_tradingday, syminfo.timezone),
     minute   (time_tradingday, syminfo.timezone)]
[utc0_day, utcN_day, utcN_hrs, utcN_min] = request.security(tickerID, timeframe.period, f_requestVars())
utcN = utc0_day > utcN_day ? utcN_hrs - 24 - utcN_min / 60 : utcN_hrs + utcN_min / 60  // symbol UTC+/-N


// === EXAMPLE USING MAIN CHART SYMBOL ===
f_UTCn(_tickerID) =>  // returns main chart symbol's UTC+/-n
    UTC0_day = dayofweek
    UTCn_day = dayofweek(time_tradingday, syminfo.timezone)
    UTCn_hrs = hour     (time_tradingday, syminfo.timezone)
    UTCn_min = minute   (time_tradingday, syminfo.timezone)
    UTC0_day > UTCn_day ? UTCn_hrs - 24 - UTCn_min / 60 : UTCn_hrs + UTCn_min / 60
UTCn = f_UTCn(tickerID)


// === TABLE OF EACH METHOD ABOVE ===
info = timeframe.isintraday ? 
 syminfo.tickerid + ' is UTC ' + str.tostring(UTCn) + '\n' +
 tickerID         + ' is UTC ' + str.tostring(UTC)  + '\n' +
 tickerID         + ' is UTC ' + str.tostring(utcN) :
 'Please Set Chart Period Lower Than "D"'
colr = timeframe.isintraday ? color.black : color.red
printTable(txt) => var table t = table.new(position.top_right, 1, 1), table.cell(t, 0, 0, txt, text_color = color.white, text_halign =  text.align_right, bgcolor = colr)
printTable(info)  // table showing timezone UTC offsets in hours & decimal minutes for example methods above

// Example Behind UTC-5
// tickerID day: Saturday 7     Sunday 1                                                 Sunday 1       Monday 2
// tickerID hrs: 19 20 21 22 23 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 00 01 02 03 04 05 06 07
// baseLine hrs: 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 00 01 02 03 04 05 06 07 08 09 10 11 12
// baseLine day: Sunday 1       Sunday 1                                                 Monday 2       Monday 2

// Example Ahead UTC+5
// tickerID day: Sunday 1       Sunday 1                                                 Monday 2       Monday 2
// tickerID hrs: 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 00 01 02 03 04 05 06 07 08 09 10 11 12
// baseLine hrs: 19 20 21 22 23 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 00 01 02 03 04 05 06 07
// baseLine day: Saturday 7     Sunday 1                                                 Sunday 1       Monday 2