本页源码来自 TradingView 公开发布的开源脚本,版权归原作者所有, 请遵循其原始许可(Pine 脚本常见 CC BY-NC-SA / MPL-2.0 / MIT)。 本项目仅用于研究检索与许可范围内的移植。
// This Pine Script® code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © CheckInTrader
//@version=6
indicator("Check-In Panel [CheckInTrader]", shorttitle = "Check-In", overlay = true)
// ─────────────────────────────────────────────────────────────────────────────
// Check-In Panel [CheckInTrader]
// Candle closes, higher-timeframe trend, daily range, sessions and the daily
// rollover, all in your own time zone, in one small panel.
// Version 1.0
// ─────────────────────────────────────────────────────────────────────────────
// ── Inputs ───────────────────────────────────────────────────────────────────
G_PANEL = "Panel"
tzLabel = input.string("(UTC-5) New York, Toronto, Miami", "Your time zone", group = G_PANEL,
options = ["(UTC-10) Honolulu", "(UTC-9) Anchorage", "(UTC-8) Los Angeles, Vancouver",
"(UTC-7) Denver, Calgary", "(UTC-7) Phoenix", "(UTC-6) Chicago, Winnipeg", "(UTC-6) Mexico City",
"(UTC-5) New York, Toronto, Miami", "(UTC-5) Bogota, Lima", "(UTC-4) Halifax", "(UTC-4) Santiago",
"(UTC-3) Sao Paulo, Buenos Aires", "(UTC+0) UTC", "(UTC+0) London, Dublin, Lisbon",
"(UTC+1) Berlin, Paris, Madrid, Rome, Amsterdam, Zurich", "(UTC+1) Lagos", "(UTC+2) Athens, Helsinki, Kyiv",
"(UTC+2) Johannesburg", "(UTC+2) Cairo", "(UTC+3) Istanbul, Moscow, Riyadh, Nairobi", "(UTC+3:30) Tehran",
"(UTC+4) Dubai, Abu Dhabi", "(UTC+5) Karachi", "(UTC+5:30) Mumbai, New Delhi", "(UTC+5:45) Kathmandu",
"(UTC+6) Dhaka", "(UTC+7) Bangkok, Jakarta, Ho Chi Minh", "(UTC+8) Singapore, Kuala Lumpur, Manila, Perth",
"(UTC+8) Hong Kong, Shanghai, Taipei", "(UTC+9) Tokyo, Seoul", "(UTC+9:30) Darwin", "(UTC+9:30) Adelaide",
"(UTC+10) Brisbane", "(UTC+10) Sydney, Melbourne, Canberra", "(UTC+12) Auckland, Wellington",
"Custom (type it below)"],
tooltip = "Pick your city or UTC offset (offsets shown are standard time - daylight saving is handled automatically). Not listed? Choose Custom and type it in the box below.")
tzCustom = input.string("", "Custom time zone", group = G_PANEL,
tooltip = "Only used when Custom is picked above. Type an offset like UTC+3 or UTC+0530, or a time zone name like Europe/Kyiv.")
tzIn = switch tzLabel
"(UTC-10) Honolulu" => "Pacific/Honolulu"
"(UTC-9) Anchorage" => "America/Anchorage"
"(UTC-8) Los Angeles, Vancouver" => "America/Los_Angeles"
"(UTC-7) Denver, Calgary" => "America/Denver"
"(UTC-7) Phoenix" => "America/Phoenix"
"(UTC-6) Chicago, Winnipeg" => "America/Chicago"
"(UTC-6) Mexico City" => "America/Mexico_City"
"(UTC-5) New York, Toronto, Miami" => "America/New_York"
"(UTC-5) Bogota, Lima" => "America/Bogota"
"(UTC-4) Halifax" => "America/Halifax"
"(UTC-4) Santiago" => "America/Santiago"
"(UTC-3) Sao Paulo, Buenos Aires" => "America/Sao_Paulo"
"(UTC+0) UTC" => "UTC"
"(UTC+0) London, Dublin, Lisbon" => "Europe/London"
"(UTC+1) Berlin, Paris, Madrid, Rome, Amsterdam, Zurich" => "Europe/Berlin"
"(UTC+1) Lagos" => "Africa/Lagos"
"(UTC+2) Athens, Helsinki, Kyiv" => "Europe/Athens"
"(UTC+2) Johannesburg" => "Africa/Johannesburg"
"(UTC+2) Cairo" => "Africa/Cairo"
"(UTC+3) Istanbul, Moscow, Riyadh, Nairobi" => "Europe/Istanbul"
"(UTC+3:30) Tehran" => "Asia/Tehran"
"(UTC+4) Dubai, Abu Dhabi" => "Asia/Dubai"
"(UTC+5) Karachi" => "Asia/Karachi"
"(UTC+5:30) Mumbai, New Delhi" => "Asia/Kolkata"
"(UTC+5:45) Kathmandu" => "Asia/Kathmandu"
"(UTC+6) Dhaka" => "Asia/Dhaka"
"(UTC+7) Bangkok, Jakarta, Ho Chi Minh" => "Asia/Bangkok"
"(UTC+8) Singapore, Kuala Lumpur, Manila, Perth" => "Asia/Singapore"
"(UTC+8) Hong Kong, Shanghai, Taipei" => "Asia/Hong_Kong"
"(UTC+9) Tokyo, Seoul" => "Asia/Tokyo"
"(UTC+9:30) Darwin" => "Australia/Darwin"
"(UTC+9:30) Adelaide" => "Australia/Adelaide"
"(UTC+10) Brisbane" => "Australia/Brisbane"
"(UTC+10) Sydney, Melbourne, Canberra" => "Australia/Sydney"
"(UTC+12) Auckland, Wellington" => "Pacific/Auckland"
=> tzCustom == "" ? "UTC" : tzCustom
layoutIn = input.string("Full", "Layout", options = ["Full", "Compact"], group = G_PANEL,
tooltip = "Compact squeezes everything into four short lines - handy on phones and busy charts.")
posIn = input.string("Top right", "Position", options = ["Top right", "Middle right", "Bottom right", "Top left", "Bottom left"], group = G_PANEL)
sizeIn = input.string("Normal", "Size", options = ["Small", "Normal", "Large"], group = G_PANEL)
themeIn = input.string("Dark", "Theme", options = ["Dark", "Light"], group = G_PANEL)
clock24 = input.bool(false, "24-hour clock", group = G_PANEL)
G_CLOSE = "Candle closes"
showClose = input.bool(true, "Show candle closes", group = G_CLOSE)
show4H = input.bool(true, "Show 4H close", group = G_CLOSE)
showD = input.bool(true, "Show daily close", group = G_CLOSE)
showW = input.bool(true, "Show weekly close", group = G_CLOSE)
warnMin = input.int(15, "Highlight when a close is within (min)", minval = 1, group = G_CLOSE)
G_TREND = "Trend"
showTrend = input.bool(true, "Show trend", group = G_TREND)
emaLen = input.int(200, "EMA length", minval = 2, group = G_TREND)
G_RANGE = "Daily range"
showRange = input.bool(true, "Show daily range used", group = G_RANGE,
tooltip = "Today's high-to-low range as a % of the average daily range. Over 100% means the day has already moved more than usual.")
adrLen = input.int(14, "Average over (days)", minval = 2, group = G_RANGE)
G_SESS = "Sessions"
showSess = input.bool(true, "Show sessions", group = G_SESS,
tooltip = "Standard forex session hours. Sydney is set in New York time (5pm-2am) so it opens at the daily rollover; Tokyo, London and New York are set in each city's own local time. Daylight saving is handled automatically.")
s1On = input.bool(true, "Sydney", inline = "s1", group = G_SESS)
s1 = input.session("1700-0200", "", inline = "s1", group = G_SESS)
s2On = input.bool(true, "Tokyo", inline = "s2", group = G_SESS)
s2 = input.session("0900-1800", "", inline = "s2", group = G_SESS)
s3On = input.bool(true, "London", inline = "s3", group = G_SESS)
s3 = input.session("0800-1700", "", inline = "s3", group = G_SESS)
s4On = input.bool(true, "New York", inline = "s4", group = G_SESS)
s4 = input.session("0800-1700", "", inline = "s4", group = G_SESS)
G_ROLL = "Daily rollover"
showRoll = input.bool(true, "Show rollover warning", group = G_ROLL,
tooltip = "Around the daily close (5pm New York for most forex and CFD brokers) spreads widen sharply for a short time. Hidden automatically on crypto.")
rollBefore = input.int(10, "Warn from (min before)", minval = 0, group = G_ROLL)
rollAfter = input.int(30, "Until (min after)", minval = 0, group = G_ROLL)
shadeRoll = input.bool(false, "Shade the rollover window on the chart (1H and lower)", group = G_ROLL)
G_ALERT = "Alerts"
alertMin = input.int(5, "Alert this many minutes before", minval = 1, group = G_ALERT,
tooltip = "Create an alert on this indicator and choose 'Any alert() function call'.")
al4H = input.bool(true, "Alert before the 4H close", group = G_ALERT)
alD = input.bool(true, "Alert before the daily close", group = G_ALERT)
alSess = input.bool(false, "Alert before session opens", group = G_ALERT)
// ── Colours ──────────────────────────────────────────────────────────────────
dark = themeIn == "Dark"
compact = layoutIn == "Compact"
cBg = dark ? #0E1B2C : #FFFFFF
cAlt = dark ? #12233A : #F3F6FA
cHead = dark ? #0B1624 : #0E1B2C
cBorder = dark ? #1C3150 : #D5DEEA
cText = dark ? #E6EDF7 : #0E1B2C
cMuted = dark ? #8094B0 : #64748B
cGreen = #22C55E
cRed = dark ? #F87171 : #DC2626
cAmber = #F59E0B
cWarnBg = dark ? #3A2A0B : #FFF4DB
cOpenBg = dark ? #10301F : #E8F8EE
txtSize = sizeIn == "Small" ? size.tiny : sizeIn == "Large" ? size.normal : size.small
headSize = sizeIn == "Small" ? size.small : sizeIn == "Large" ? size.large : size.normal
tblPos = posIn == "Top right" ? position.top_right : posIn == "Middle right" ? position.middle_right :
posIn == "Bottom right" ? position.bottom_right : posIn == "Top left" ? position.top_left : position.bottom_left
// ── Helpers ──────────────────────────────────────────────────────────────────
MIN = 60000
HOUR = 3600000
DAY = 86400000
fmtDur(int ms) =>
m = math.max(0, int(math.floor(ms / MIN)))
d = int(math.floor(m / 1440))
h = int(math.floor((m - d * 1440) / 60))
mm = m - d * 1440 - h * 60
d > 0 ? str.tostring(d) + "d " + str.tostring(h) + "h" : h > 0 ? str.tostring(h) + "h " + str.tostring(mm, "00") + "m" : str.tostring(mm) + "m"
fmtClock(int t) =>
sameDay = dayofmonth(t, tzIn) == dayofmonth(timenow, tzIn)
f = clock24 ? "HH:mm" : "h:mma"
sameDay ? str.format_time(t, f, tzIn) : str.format_time(t, "EEE " + f, tzIn)
bar8(float frac) =>
n = int(math.round(math.max(0.0, math.min(1.0, frac)) * 8))
s = ""
for i = 1 to 8
s += i <= n ? "▰" : "▱"
s
// Session start/end hours from an "HHMM-HHMM" string
sessParts(string s) =>
oh = int(str.tonumber(str.substring(s, 0, 2)))
om = int(str.tonumber(str.substring(s, 2, 4)))
ch = int(str.tonumber(str.substring(s, 5, 7)))
cm = int(str.tonumber(str.substring(s, 7, 9)))
[oh, om, ch, cm]
// Forex week: Sunday 5pm to Friday 5pm New York
fxOpen(int t) =>
dw = dayofweek(t, "America/New_York")
h = hour(t, "America/New_York")
not (dw == dayofweek.saturday or (dw == dayofweek.friday and h >= 17) or (dw == dayofweek.sunday and h < 17))
// Returns [open now?, ms until change, time of next change]
sessInfo(string s, string tz) =>
[oh, om, ch, cm] = sessParts(s)
y = year(timenow, tz)
mo = month(timenow, tz)
d = dayofmonth(timenow, tz)
o = timestamp(tz, y, mo, d, oh, om)
dur0 = timestamp(tz, y, mo, d, ch, cm) - o
dur = dur0 <= 0 ? dur0 + DAY : dur0
oPrev = o - DAY
inToday = timenow >= o and timenow < o + dur and fxOpen(o)
inPrev = timenow >= oPrev and timenow < oPrev + dur and fxOpen(oPrev)
openNow = inToday or inPrev
curO = inToday ? o : oPrev
int nxt = timenow < o ? o : o + DAY
for k = 0 to 4
nxt := timestamp(tz, year(nxt, tz), month(nxt, tz), dayofmonth(nxt, tz), oh, om)
if not fxOpen(nxt)
nxt += DAY
left = openNow ? curO + dur - timenow : nxt - timenow
at = openNow ? curO + dur : nxt
[openNow, left, at]
// Compact view: collects open sessions and the next one to open
sessAcc(bool on, string name, string s, string tz, string opens, string nxtName, int nxtLeft) =>
string o2 = opens
string n2 = nxtName
int l2 = nxtLeft
if on
[op, left, at] = sessInfo(s, tz)
if op
o2 := o2 == "" ? name : o2 + " + " + name
else if left < l2
n2 := name
l2 := left
[o2, n2, l2]
// ── Candle close times ───────────────────────────────────────────────────────
tfSec = timeframe.in_seconds()
isCrypto = syminfo.type == "crypto"
tD = tfSec <= 86400 ? time_close("D") : na
// Weekly: the last trading close of the week (Friday 5pm New York for forex/CFDs), not the weekend boundary
wRaw = time_close("W")
int tW = wRaw
if not isCrypto and not na(wRaw)
for k = 0 to 3
dw = dayofweek(tW - MIN, "America/New_York")
if dw == dayofweek.saturday or dw == dayofweek.sunday
tW -= DAY
int t4 = na
if tfSec <= 14400
t4 := time_close("240")
else if not na(tD)
n = int(math.floor((tD - timenow) / (4 * HOUR)))
t4 := tD - n * 4 * HOUR
mktClosed = not na(tD) and tD < timenow - 5 * MIN and not isCrypto
wkndClosed = not fxOpen(timenow)
// ── Trend (EMA) ──────────────────────────────────────────────────────────────
[cW, eW] = request.security(syminfo.tickerid, "W", [close, ta.ema(close, emaLen)])
[cD, eD] = request.security(syminfo.tickerid, "D", [close, ta.ema(close, emaLen)])
[c4, e4] = request.security(syminfo.tickerid, "240", [close, ta.ema(close, emaLen)])
// ── Daily range used ─────────────────────────────────────────────────────────
[dH, dL, dAdr] = request.security(syminfo.tickerid, "D", [high, low, ta.sma(high - low, adrLen)[1]])
haveRange = showRange and tfSec <= 86400 and not na(dH) and not na(dAdr) and dAdr > 0
rngPct = haveRange ? (dH - dL) / dAdr * 100 : na
isFx = syminfo.type == "forex"
adrTxt = haveRange ? (isFx ? str.tostring(dAdr / (syminfo.mintick * 10), "#") + " pips" : str.tostring(dAdr, format.mintick)) : ""
// ── Rollover state ───────────────────────────────────────────────────────────
rollOk = showRoll and not isCrypto and not na(tD) and not mktClosed
prevRoll = tD - DAY
inPost = rollOk and timenow < prevRoll + rollAfter * MIN
inRoll = rollOk and ((timenow >= tD - rollBefore * MIN) or inPost)
rollUntil = (inPost ? prevRoll : tD) + rollAfter * MIN
// ── Rollover shading on the chart ────────────────────────────────────────────
barDayClose = time_close("D")
inRollBar = not na(barDayClose) and ((time >= barDayClose - rollBefore * MIN and time < barDayClose + rollAfter * MIN) or (time < barDayClose - DAY + rollAfter * MIN and time >= barDayClose - DAY - rollBefore * MIN))
bgcolor(showRoll and shadeRoll and not isCrypto and tfSec <= 3600 and inRollBar ? color.new(cAmber, 88) : na, title = "Rollover window")
// ── Panel ────────────────────────────────────────────────────────────────────
var table T = table.new(tblPos, 3, 26, bgcolor = cBg, frame_color = cBorder, frame_width = 1, border_color = cBg, border_width = 2)
cellRow(int r, string a, string b, string c, color ca, color cb, color cc, color bg) =>
table.cell(T, 0, r, a, text_color = ca, text_size = txtSize, text_halign = text.align_left, bgcolor = bg)
table.cell(T, 1, r, b, text_color = cb, text_size = txtSize, text_halign = text.align_left, bgcolor = bg)
table.cell(T, 2, r, c, text_color = cc, text_size = txtSize, text_halign = text.align_right, bgcolor = bg)
r + 1
wideRow(int r, string t, color tc, color bg) =>
table.cell(T, 0, r, t, text_color = tc, text_size = txtSize, text_halign = text.align_left, bgcolor = bg)
table.merge_cells(T, 0, r, 2, r)
r + 1
section(int r, string name) =>
table.cell(T, 0, r, name, text_color = cGreen, text_size = size.tiny, text_halign = text.align_left, bgcolor = cBg)
table.merge_cells(T, 0, r, 2, r)
r + 1
closeRow(int r, string name, int tc, int period) =>
int out = r
if not na(tc)
left = tc - timenow
warn = left <= warnMin * MIN and left > 0
frac = 1.0 - left / period
out := cellRow(r, name, bar8(frac) + " " + fmtDur(left), fmtClock(tc), cText, warn ? cAmber : cText, cMuted, warn ? cWarnBg : cAlt)
out
trendRow(int r, string name, float c, float e) =>
int out = r
if not na(c) and not na(e)
up = c >= e
pct = (c - e) / e * 100
out := cellRow(r, name, (up ? "▲ Above " : "▼ Below ") + (pct >= 0 ? "+" : "") + str.tostring(pct, "0.0") + "%", "EMA " + str.tostring(emaLen), cText, up ? cGreen : cRed, cMuted, cAlt)
else
out := cellRow(r, name, "not enough history", "", cText, cMuted, cMuted, cAlt)
out
sessRow(int r, string name, string s, string tz) =>
[openNow, left, at] = sessInfo(s, tz)
cellRow(r, (openNow ? "● " : "○ ") + name, openNow ? "Open · " + fmtDur(left) + " left" : "Opens in " + fmtDur(left), fmtClock(at), openNow ? cGreen : cText, openNow ? cText : cMuted, cMuted, openNow ? cOpenBg : cAlt)
// Compact cells
cmpClose(int col, int r, string name, int tc, bool on) =>
has = on and not na(tc)
left = has ? tc - timenow : 0
warn = has and left <= warnMin * MIN and left > 0
table.cell(T, col, r, has ? name + " " + fmtDur(left) : "", text_color = warn ? cAmber : cText, text_size = txtSize, text_halign = text.align_center, bgcolor = warn ? cWarnBg : cAlt)
cmpTrend(int col, int r, string name, float c, float e) =>
ok = not na(c) and not na(e)
up = ok and c >= e
table.cell(T, col, r, name + (ok ? (up ? " ▲" : " ▼") : " –"), text_color = ok ? (up ? cGreen : cRed) : cMuted, text_size = txtSize, text_halign = text.align_center, bgcolor = cAlt)
if barstate.islast
table.clear(T, 0, 0, 2, 25)
int row = 0
// Header
table.cell(T, 0, row, compact ? "✓ CHECK-IN" : "✓ CHECK-IN PANEL", text_color = #FFFFFF, text_size = compact ? txtSize : headSize, text_halign = text.align_left, bgcolor = cHead)
table.merge_cells(T, 0, row, 1, row)
table.cell(T, 2, row, str.format_time(timenow, clock24 ? "EEE HH:mm" : "EEE h:mma", tzIn), text_color = #B6C4D8, text_size = txtSize, text_halign = text.align_right, bgcolor = cHead)
row += 1
if compact
if mktClosed
row := wideRow(row, wkndClosed ? "Market closed for the weekend" : "Market closed · daily break", cAmber, cWarnBg)
else if showClose
cmpClose(0, row, "4H", t4, show4H)
cmpClose(1, row, "D", tD, showD)
cmpClose(2, row, "W", tW, showW)
row += 1
if showTrend
cmpTrend(0, row, "W", cW, eW)
cmpTrend(1, row, "D", cD, eD)
cmpTrend(2, row, "4H", c4, e4)
row += 1
if haveRange
big = rngPct >= 100
row := wideRow(row, "Range " + bar8(rngPct / 100) + " " + str.tostring(rngPct, "0") + "% of avg", big ? cAmber : cText, big ? cWarnBg : cAlt)
if inRoll
row := wideRow(row, "⚠ Rollover · spreads wide until " + fmtClock(rollUntil), cAmber, cWarnBg)
else if showSess and not mktClosed
[o1, n1, l1] = sessAcc(s1On, "Sydney", s1, "America/New_York", "", "", 30 * DAY)
[o2, n2, l2] = sessAcc(s2On, "Tokyo", s2, "Asia/Tokyo", o1, n1, l1)
[o3, n3, l3] = sessAcc(s3On, "London", s3, "Europe/London", o2, n2, l2)
[o4, n4, l4] = sessAcc(s4On, "New York", s4, "America/New_York", o3, n3, l3)
if o4 != "" or n4 != ""
txt = o4 != "" ? "● " + o4 + " open" + (n4 != "" ? " · " + n4 + " in " + fmtDur(l4) : "") : "○ " + n4 + " opens in " + fmtDur(l4)
row := wideRow(row, txt, o4 != "" ? cGreen : cText, o4 != "" ? cOpenBg : cAlt)
else
if mktClosed
row := cellRow(row, "Market", wkndClosed ? "Closed for the weekend" : "Closed · daily break", "", cText, cAmber, cMuted, cWarnBg)
if showClose and not mktClosed
row := section(row, "CANDLE CLOSES")
if show4H
row := closeRow(row, "4H", t4, 4 * HOUR)
if showD
row := closeRow(row, "Daily", tD, DAY)
if showW
row := closeRow(row, "Weekly", tW, (isCrypto ? 7 : 5) * DAY)
if showTrend
row := section(row, "TREND · PRICE vs EMA " + str.tostring(emaLen))
row := trendRow(row, "Weekly", cW, eW)
row := trendRow(row, "Daily", cD, eD)
row := trendRow(row, "4H", c4, e4)
if haveRange
big = rngPct >= 100
row := section(row, "DAILY RANGE · vs " + str.tostring(adrLen) + "-DAY AVERAGE")
row := cellRow(row, "Today", bar8(rngPct / 100) + " " + str.tostring(rngPct, "0") + "%", "avg " + adrTxt, cText, big ? cAmber : cText, cMuted, big ? cWarnBg : cAlt)
if showSess
row := section(row, "SESSIONS")
if s1On
row := sessRow(row, "Sydney", s1, "America/New_York")
if s2On
row := sessRow(row, "Tokyo", s2, "Asia/Tokyo")
if s3On
row := sessRow(row, "London", s3, "Europe/London")
if s4On
row := sessRow(row, "New York", s4, "America/New_York")
if rollOk
row := section(row, "DAILY ROLLOVER")
if inRoll
row := cellRow(row, "⚠ Spreads wide", "Avoid entries and exits", "until " + fmtClock(rollUntil), cAmber, cAmber, cMuted, cWarnBg)
else
row := cellRow(row, "Rollover", "in " + fmtDur(tD - timenow), fmtClock(tD), cText, cText, cMuted, cAlt)
table.cell(T, 0, row, "CheckInTrader", text_color = cMuted, text_size = size.tiny, text_halign = text.align_right, bgcolor = cBg)
table.merge_cells(T, 0, row, 2, row)
// ── Alerts ───────────────────────────────────────────────────────────────────
varip int lastA4 = 0
varip int lastAD = 0
if barstate.isrealtime
if al4H and not na(t4) and t4 > timenow and t4 - timenow <= alertMin * MIN and lastA4 != t4
alert(syminfo.ticker + ": 4H candle closes in " + str.tostring(alertMin) + " min (" + fmtClock(t4) + ")", alert.freq_all)
lastA4 := t4
if alD and not na(tD) and tD > timenow and tD - timenow <= alertMin * MIN and lastAD != tD
alert(syminfo.ticker + ": Daily candle closes in " + str.tostring(alertMin) + " min (" + fmtClock(tD) + ")", alert.freq_all)
lastAD := tD
varip int lastS1 = 0
varip int lastS2 = 0
varip int lastS3 = 0
varip int lastS4 = 0
sessAlert(bool on, string name, string s, string tz, int last) =>
int out = last
if on and alSess
[openNow, left, at] = sessInfo(s, tz)
if not openNow and left <= alertMin * MIN and last != at
alert(name + " session opens in " + str.tostring(alertMin) + " min (" + fmtClock(at) + ")", alert.freq_all)
out := at
out
if barstate.isrealtime
lastS1 := sessAlert(s1On, "Sydney", s1, "America/New_York", lastS1)
lastS2 := sessAlert(s2On, "Tokyo", s2, "Asia/Tokyo", lastS2)
lastS3 := sessAlert(s3On, "London", s3, "Europe/London", lastS3)
lastS4 := sessAlert(s4On, "New York", s4, "America/New_York", lastS4)