PROTECTED SOURCE SCRIPT
Session Boxes With Vol

//version=5
indicator("Session Boxes with Small Black Markers (IST)", overlay=true)
// --------------------
// Session times (IST)
// --------------------
asianStart = 0530
asianEnd = 1130
londonStart = 1230
londonEnd = 1330
nyStart = 1830
nyEnd = 1930
// --------------------
// Helpers: current bar time in IST (hhmm)
// --------------------
sessHour = hour(time, "GMT+5:30")
sessMinute = minute(time, "GMT+5:30")
sessTime = sessHour * 100 + sessMinute
inSession(startT, endT) =>
sessTime >= startT and sessTime < endT
// --------------------
// Colors
// --------------------
asiaFill = color.new(color.rgb(173, 216, 230), 81) // light blue
greyFill = color.new(color.rgb(184, 184, 184), 81) // grey
// --------------------
// Persistent variables
// --------------------
var box asiaBox = na
var label asiaLbl = na
var box londonBox = na
var box nyBox = na
// --------------------
// Utility: small vertical marker (5% of chart height)
// --------------------
createMarker() =>
rng = high - low
off = rng * 0.05
line.new(x1 = bar_index, y1 = low - off, x2 = bar_index, y2 = low + off,
xloc = xloc.bar_index, color = color.black, width = 2)
// --------------------
// Asia session
// --------------------
if inSession(asianStart, asianEnd)
if na(asiaBox)
asiaBox := box.new(left = bar_index, right = bar_index, top = high, bottom = low,
bgcolor = asiaFill, border_width = 0)
asiaLbl := label.new(x = bar_index, y = high, text = "ASIA",
style = label.style_label_left, textcolor = color.black,
color = na, size = size.normal)
createMarker() // start marker
else
box.set_right(asiaBox, bar_index)
box.set_top(asiaBox, math.max(box.get_top(asiaBox), high))
box.set_bottom(asiaBox, math.min(box.get_bottom(asiaBox), low))
label.set_x(asiaLbl, bar_index)
label.set_y(asiaLbl, box.get_top(asiaBox))
else
if not na(asiaBox)
createMarker() // end marker
asiaBox := na
asiaLbl := na
// --------------------
// London session
// --------------------
if inSession(londonStart, londonEnd)
if na(londonBox)
londonBox := box.new(left = bar_index, right = bar_index, top = high, bottom = low,
bgcolor = greyFill, border_width = 0)
createMarker() // start marker
else
box.set_right(londonBox, bar_index)
box.set_top(londonBox, math.max(box.get_top(londonBox), high))
box.set_bottom(londonBox, math.min(box.get_bottom(londonBox), low))
else
if not na(londonBox)
createMarker() // end marker
londonBox := na
// --------------------
// New York session
// --------------------
if inSession(nyStart, nyEnd)
if na(nyBox)
nyBox := box.new(left = bar_index, right = bar_index, top = high, bottom = low,
bgcolor = greyFill, border_width = 0)
createMarker() // start marker
else
box.set_right(nyBox, bar_index)
box.set_top(nyBox, math.max(box.get_top(nyBox), high))
box.set_bottom(nyBox, math.min(box.get_bottom(nyBox), low))
else
if not na(nyBox)
createMarker() // end marker
nyBox := na
indicator("Session Boxes with Small Black Markers (IST)", overlay=true)
// --------------------
// Session times (IST)
// --------------------
asianStart = 0530
asianEnd = 1130
londonStart = 1230
londonEnd = 1330
nyStart = 1830
nyEnd = 1930
// --------------------
// Helpers: current bar time in IST (hhmm)
// --------------------
sessHour = hour(time, "GMT+5:30")
sessMinute = minute(time, "GMT+5:30")
sessTime = sessHour * 100 + sessMinute
inSession(startT, endT) =>
sessTime >= startT and sessTime < endT
// --------------------
// Colors
// --------------------
asiaFill = color.new(color.rgb(173, 216, 230), 81) // light blue
greyFill = color.new(color.rgb(184, 184, 184), 81) // grey
// --------------------
// Persistent variables
// --------------------
var box asiaBox = na
var label asiaLbl = na
var box londonBox = na
var box nyBox = na
// --------------------
// Utility: small vertical marker (5% of chart height)
// --------------------
createMarker() =>
rng = high - low
off = rng * 0.05
line.new(x1 = bar_index, y1 = low - off, x2 = bar_index, y2 = low + off,
xloc = xloc.bar_index, color = color.black, width = 2)
// --------------------
// Asia session
// --------------------
if inSession(asianStart, asianEnd)
if na(asiaBox)
asiaBox := box.new(left = bar_index, right = bar_index, top = high, bottom = low,
bgcolor = asiaFill, border_width = 0)
asiaLbl := label.new(x = bar_index, y = high, text = "ASIA",
style = label.style_label_left, textcolor = color.black,
color = na, size = size.normal)
createMarker() // start marker
else
box.set_right(asiaBox, bar_index)
box.set_top(asiaBox, math.max(box.get_top(asiaBox), high))
box.set_bottom(asiaBox, math.min(box.get_bottom(asiaBox), low))
label.set_x(asiaLbl, bar_index)
label.set_y(asiaLbl, box.get_top(asiaBox))
else
if not na(asiaBox)
createMarker() // end marker
asiaBox := na
asiaLbl := na
// --------------------
// London session
// --------------------
if inSession(londonStart, londonEnd)
if na(londonBox)
londonBox := box.new(left = bar_index, right = bar_index, top = high, bottom = low,
bgcolor = greyFill, border_width = 0)
createMarker() // start marker
else
box.set_right(londonBox, bar_index)
box.set_top(londonBox, math.max(box.get_top(londonBox), high))
box.set_bottom(londonBox, math.min(box.get_bottom(londonBox), low))
else
if not na(londonBox)
createMarker() // end marker
londonBox := na
// --------------------
// New York session
// --------------------
if inSession(nyStart, nyEnd)
if na(nyBox)
nyBox := box.new(left = bar_index, right = bar_index, top = high, bottom = low,
bgcolor = greyFill, border_width = 0)
createMarker() // start marker
else
box.set_right(nyBox, bar_index)
box.set_top(nyBox, math.max(box.get_top(nyBox), high))
box.set_bottom(nyBox, math.min(box.get_bottom(nyBox), low))
else
if not na(nyBox)
createMarker() // end marker
nyBox := na
보호된 스크립트입니다
이 스크립트는 비공개 소스로 게시됩니다. 하지만 이를 자유롭게 제한 없이 사용할 수 있습니다 – 자세한 내용은 여기에서 확인하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
보호된 스크립트입니다
이 스크립트는 비공개 소스로 게시됩니다. 하지만 이를 자유롭게 제한 없이 사용할 수 있습니다 – 자세한 내용은 여기에서 확인하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.