//@version=5 // Baroq Gold Sessions and Ranges. Open source under the Mozilla Public License 2.0, (c) 2026 Baroq Tech. // Draws the Asia, London and New York sessions as boxes that grow with each session's high and low, and writes each // range's size on its box. Education and chart reading only: it never trades and it is not advice. indicator("Baroq Gold Sessions and Ranges", shorttitle="Baroq Sessions", overlay=true, max_boxes_count=300) tz = input.string("UTC", "Time zone of the session hours", tooltip="For example UTC, Europe/London or America/New_York") asiaOn = input.bool(true, "Asia", inline="asia", group="Sessions") asiaSess = input.session("0000-0700", "", inline="asia", group="Sessions") asiaCol = input.color(color.new(#7e8ce0, 0), "", inline="asia", group="Sessions") londonOn = input.bool(true, "London", inline="ldn", group="Sessions") londonSess = input.session("0700-1300", "", inline="ldn", group="Sessions") londonCol = input.color(color.new(#e8c36a, 0), "", inline="ldn", group="Sessions") nyOn = input.bool(true, "New York", inline="ny", group="Sessions") nySess = input.session("1300-2000", "", inline="ny", group="Sessions") nyCol = input.color(color.new(#4fb08a, 0), "", inline="ny", group="Sessions") showSize = input.bool(true, "Write the range size on each box") session(on, sess, col, name) => var box b = na var float hi = na var float lo = na inSess = on and timeframe.isintraday and not na(time(timeframe.period, sess, tz)) if inSess and (na(inSess[1]) or not inSess[1]) hi := high lo := low b := box.new(bar_index, high, bar_index, low, border_color=color.new(col, 30), bgcolor=color.new(col, 88), text=name, text_size=size.small, text_color=col, text_halign=text.align_left, text_valign=text.align_top) else if inSess hi := math.max(hi, high) lo := math.min(lo, low) box.set_top(b, hi) box.set_bottom(b, lo) box.set_right(b, bar_index) if inSess and showSize box.set_text(b, name + " " + str.tostring(hi - lo, format.mintick)) inSess session(asiaOn, asiaSess, asiaCol, "Asia") session(londonOn, londonSess, londonCol, "London") session(nyOn, nySess, nyCol, "New York")