1Copy the scriptPress Copy script above, or the copy button on the code below.
2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
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.
Highlights Asia, London, and New York trading sessions
Visual range boxes showing session high and low levels
Optional session name labels
Live status table showing active sessions
Customizable session times, colors, and timezone settings
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
Show Asia
bool
true
asiaEnabled
Asia Time
session
0000-0900
asiaStart
Asia Color
color
color.new(color.blue, 88)
asiaColor
Show London
bool
true
londonEnabled
London Time
session
0800-1630
londonStart
London Color
color
color.new(color.green, 88)
londonColor
Show New York
bool
true
nyEnabled
New York Time
session
1330-2200
nyStart
New York Color
color
color.new(color.orange, 88)
nyColor
Timezone
string
Europe/Berlin
tz
Show Session Labels
bool
true
showLabels
Keep N sessions
int
30
keepN
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.
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-
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
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
Indicatorv6SMC / ICT / price actionSessions & time
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
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
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