Indicator · Pine Script v6 · On the chart

Session Highlighter

by Timonkru

The Session Highlighter indicator draws colored boxes over Asia, London, and New York trading sessions directly on the price chart.

View on GitHub

GitHub stars1on the repository
Pine versionv6current
Lines of code99
Settings12inputs
LicenceMIT
Last update8 months ago20 Feb 2026

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.

Source Code

99 lines of Pine Script v6 from session-highlighter.pine, published under MIT. Keep the author's credit and licence lines when you reuse it.

session-highlighter.pine
//@version=6
indicator("Session Highlighter", overlay=true, max_boxes_count=500)

// === INPUTS ===
grp1 = "Asia Session"
asiaEnabled = input.bool(true, "Show Asia", group=grp1)
asiaStart   = input.session("0000-0900", "Asia Time", group=grp1)
asiaColor   = input.color(color.new(color.blue, 88), "Asia Color", group=grp1)

grp2 = "London Session"
londonEnabled = input.bool(true, "Show London", group=grp2)
londonStart   = input.session("0800-1630", "London Time", group=grp2)
londonColor   = input.color(color.new(color.green, 88), "London Color", group=grp2)

grp3 = "New York Session"
nyEnabled = input.bool(true, "Show New York", group=grp3)
nyStart   = input.session("1330-2200", "New York Time", group=grp3)
nyColor   = input.color(color.new(color.orange, 88), "New York Color", group=grp3)

grp4 = "General"
tz       = input.string("Europe/Berlin", "Timezone", group=grp4)
showLabels = input.bool(true, "Show Session Labels", group=grp4)
keepN    = input.int(30, "Keep N sessions", minval=1, maxval=100, group=grp4)

// === SESSION DETECTION ===
inAsia   = not na(time(timeframe.period, asiaStart, tz))
inLondon = not na(time(timeframe.period, londonStart, tz))
inNY     = not na(time(timeframe.period, nyStart, tz))

startAsia   = asiaEnabled and inAsia and not inAsia[1]
endAsia     = asiaEnabled and not inAsia and inAsia[1]
startLondon = londonEnabled and inLondon and not inLondon[1]
endLondon   = londonEnabled and not inLondon and inLondon[1]
startNY     = nyEnabled and inNY and not inNY[1]
endNY       = nyEnabled and not inNY and inNY[1]

// === RANGE TRACKING ===
var float asiaH = na, var float asiaL = na, var int asiaLeft = na
var float londonH = na, var float londonL = na, var int londonLeft = na
var float nyH = na, var float nyL = na, var int nyLeft = na

// Asia
if startAsia
    asiaH := high, asiaL := low, asiaLeft := time
if inAsia and asiaEnabled
    asiaH := math.max(nz(asiaH, high), high)
    asiaL := math.min(nz(asiaL, low), low)

// London
if startLondon
    londonH := high, londonL := low, londonLeft := time
if inLondon and londonEnabled
    londonH := math.max(nz(londonH, high), high)
    londonL := math.min(nz(londonL, low), low)

// New York
if startNY
    nyH := high, nyL := low, nyLeft := time
if inNY and nyEnabled
    nyH := math.max(nz(nyH, high), high)
    nyL := math.min(nz(nyL, low), low)

// === STORAGE ===
var array<box> asiaBoxes = array.new<box>()
var array<box> londonBoxes = array.new<box>()
var array<box> nyBoxes = array.new<box>()
var array<label> allLabels = array.new<label>()

// === BOX CREATION ===
createBox(condition, leftT, h, l, col, boxArr, lblText) =>
    if condition and not na(leftT) and not na(h) and not na(l)
        b = box.new(leftT, h, time, l, xloc=xloc.bar_time, bgcolor=col, border_color=color.new(col, 50), border_width=1)
        array.push(boxArr, b)
        if showLabels
            lbl = label.new(leftT, h, lblText, xloc=xloc.bar_time, style=label.style_label_down, color=color.new(col, 30), textcolor=color.white, size=size.tiny)
            array.push(allLabels, lbl)
        while array.size(boxArr) > keepN
            box.delete(array.shift(boxArr))
        while array.size(allLabels) > keepN * 3
            label.delete(array.shift(allLabels))

createBox(endAsia, asiaLeft, asiaH, asiaL, asiaColor, asiaBoxes, "Asia")
createBox(endLondon, londonLeft, londonH, londonL, londonColor, londonBoxes, "London")
createBox(endNY, nyLeft, nyH, nyL, nyColor, nyBoxes, "NY")

// === INFO TABLE ===
var table t = table.new(position.bottom_right, 2, 4, border_width=1)
if barstate.islast
    table.cell(t, 0, 0, "Session", text_color=color.gray, bgcolor=color.new(color.black, 70), text_size=size.tiny)
    table.cell(t, 1, 0, "Status", text_color=color.gray, bgcolor=color.new(color.black, 70), text_size=size.tiny)

    table.cell(t, 0, 1, "Asia", text_color=color.white, bgcolor=color.new(color.blue, 80), text_size=size.tiny)
    table.cell(t, 1, 1, inAsia and asiaEnabled ? "ACTIVE" : "closed", text_color=inAsia and asiaEnabled ? color.lime : color.gray, bgcolor=color.new(color.blue, 80), text_size=size.tiny)

    table.cell(t, 0, 2, "London", text_color=color.white, bgcolor=color.new(color.green, 80), text_size=size.tiny)
    table.cell(t, 1, 2, inLondon and londonEnabled ? "ACTIVE" : "closed", text_color=inLondon and londonEnabled ? color.lime : color.gray, bgcolor=color.new(color.green, 80), text_size=size.tiny)

    table.cell(t, 0, 3, "New York", text_color=color.white, bgcolor=color.new(color.orange, 80), text_size=size.tiny)
    table.cell(t, 1, 3, inNY and nyEnabled ? "ACTIVE" : "closed", text_color=inNY and nyEnabled ? color.lime : color.gray, bgcolor=color.new(color.orange, 80), text_size=size.tiny)

Overview

Session Highlighter calculates the session high and low price bounds based on custom session hours and timezone configurations. Upon session completion, it constructs visual range boxes with optional top labels and tracks active sessions via an on-screen status panel. Users can customize colors, session times, and limit the total number of historical session boxes displayed.

Details

Published by

Timonkru on GitHub

Draws

On the price chart

Markets

Any symbol

Timeframes

M1-M5, M15-H1

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
Show AsiabooltrueasiaEnabled
Asia Timesession0000-0900asiaStart
Asia Colorcolorcolor.new(color.blue, 88)asiaColor
Show LondonbooltruelondonEnabled
London Timesession0800-1630londonStart
London Colorcolorcolor.new(color.green, 88)londonColor
Show New YorkbooltruenyEnabled
New York Timesession1330-2200nyStart
New York Colorcolorcolor.new(color.orange, 88)nyColor
TimezonestringEurope/Berlintz
Show Session LabelsbooltrueshowLabels
Keep N sessionsint30keepN
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.

Similar Pine Scripts

575 stars

This indicator builds Market Profile Time Price Opportunity (TPO) structures across defined session timeframes directly on the main price chart. It visualizes the Point of Control (POC) and Value Area boundaries using dynamic box drawings. An integrated multi-

Indicator v5 Support & resistanceScreeners & dashboards
Updated 1 year ago · MPL-2.0 GitHub repository of Market Profile with Screener
257 stars

This indicator plots auto trade signals for E-mini S&P 500 futures on the price chart. It computes an EMA200 filter along with day ETH RTH session levels and percentage-based entry zones. Signals trigger CALL or PUT cases when price crosses defined thresholds

Indicator v6 TrendSupport & resistance
Updated 7 weeks ago · None stated GitHub repository of Auto Trade Futures ES

Golden Bullet Strategy

by TradersPost
228 stars

The Golden Bullet Strategy is an overlay signal indicator based on Smart Money Concepts and time-based liquidity models. It identifies liquidity sweeps of a designated reference session range during a specified hunt window. It then confirms Market Structure Sh

Indicator v6 SMC / ICT / price actionSessions & time
Updated 3 months ago · None stated GitHub repository of Golden Bullet Strategy
219 stars

This indicator plots reference levels for previous daily high and low prices directly on the price chart. It requests daily timeframe data using the security function and plots the offset values as continuous lines, displaying resistance in red and support in

Indicator v4 Support & resistanceSessions & time
Updated 5 years ago · None stated GitHub repository of 昨日高低點標示

Moon Dev GEX Arrows

by moondevonyt
92 stars

This overlay indicator plots option strike walls and an optional session VWAP on the price chart for SPY or ES. It spaces major strikes by the selected instrument, draws a set number of strikes on each side, and marks wall-trap and sweep events after a cooldow

Indicator v5 Support & resistanceSessions & time
Updated 2 months ago · Custom licence GitHub repository of Moon Dev GEX Arrows

Key Levels

by cryptorife
75 stars

This indicator plots reference levels and session markers directly on the price chart. It calculates and draws lines for the daily open, weekly open, monthly open, previous day OHLC, and previous week extremes, along with a selectable day-of-week range and ini

Indicator v4 Support & resistanceSessions & time Repaints
Updated 3 years ago · GPL-3.0 GitHub repository of Key Levels

More Sessions & time scripts

Related on ForexR

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers