Indicator · Pine Script v6 · On the chart

Session Highs and Lows Indicator (SMC Sessions, DST-safe)

by tc3oliver

This overlay indicator marks the high and low of four Smart Money Concepts killzones on the price chart.

View on GitHub

GitHub stars1on the repository
Pine versionv6current
Lines of code130
Settings16inputs
LicenceMPL-2.0
Last update6 weeks ago10 Sep 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

130 lines of Pine Script v6 from session-highs-and-lows-indicator/main.pine, published under MPL-2.0. Keep the author's credit and licence lines when you reuse it.

main.pine
// TradingView Pine Script V5 Indicator to mark the latest important levels
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © tc3oliver

//@version=6
indicator("Session Highs and Lows Indicator (SMC Sessions, DST-safe)", overlay=true)

// Session windows are meaningless once one candle spans the whole day —
// without this guard the script silently draws wrong levels on 1D and above.
if not timeframe.isintraday and barstate.islast
    runtime.error("This indicator requires an intraday timeframe (< 1D).")

// ======== Visibility toggles ========
// Names must match the killzone names used on the chart labels below.
showLondon      = input.bool(true, "Show London Open Killzone")
showNewYork     = input.bool(true, "Show New York AM Killzone")
showAsia        = input.bool(true, "Show Asian Range")
showLondonClose = input.bool(true, "Show London Close Killzone")

// ======== Line styling ========
londonColor      = input.color(color.new(#47abfd, 70), "London Open Line Color")
londonWidth      = input.int(1, "London Open Line Width", minval=1, maxval=5)

newYorkColor     = input.color(color.new(#ff6565, 70), "New York AM Line Color")
newYorkWidth     = input.int(1, "New York AM Line Width", minval=1, maxval=5)

londonCloseColor = input.color(color.new(#ff9f43, 70), "London Close Line Color")
londonCloseWidth = input.int(1, "London Close Line Width", minval=1, maxval=5)

asiaColor        = input.color(color.new(#75ff79, 70), "Asian Range Line Color")
asiaWidth        = input.int(1, "Asian Range Line Width", minval=1, maxval=5)

// --- SMC/ICT Sessions in New York time (DST-safe via America/New_York) ---
asianRangeSession  = input.session("2000-0000", "Asian Range [NY time]")
londonSession      = input.session("0300-0500", "London Open [NY time]")
newYorkSession     = input.session("0830-1100", "New York AM [NY time]")
londonCloseSession = input.session("1000-1200", "London Close [NY time]")

TZ = "America/New_York"

// ======== High/low tracking for a single session ========
// A function-local `var` holds independent state per call site, so all four
// sessions share this one implementation. Deliberately not an array or UDT:
// container rollback on realtime bars is a known source of repainting.
// Must be called unconditionally on every bar or the var state desyncs.
trackSession(sess, show, col, wid, name) =>
    // v6: a `bool` can never be `na`, so `inSess[1]` is already false on the
    // first bar. The v5 code wrapped it in nz(), which v6 rejects for bools.
    inSess  = not na(time("", sess, TZ))
    isStart = inSess and not inSess[1]
    isEnd   = not inSess and inSess[1]

    var float hi       = na
    var float lo       = na
    var int   hiBar    = na
    var int   loBar    = na
    var int   startBar = na
    var label hiLbl    = na
    var label loLbl    = na
    var line  hiLn     = na
    var line  loLn     = na
    var label warnLbl  = na

    if isStart
        hi := high
        lo := low
        hiBar := bar_index
        loBar := bar_index
        startBar := bar_index
    else if inSess
        if high > hi
            hi := high
            hiBar := bar_index
        if low < lo
            lo := low
            loBar := bar_index
    else if isEnd and show
        label.delete(hiLbl)
        label.delete(loLbl)
        line.delete(hiLn)
        line.delete(loLn)
        hiLbl := label.new(hiBar, hi, name + " High", yloc=yloc.abovebar, color=col, textcolor=color.white, style=label.style_label_down, size=size.small)
        loLbl := label.new(loBar, lo, name + " Low",  yloc=yloc.belowbar, color=col, textcolor=color.white, style=label.style_label_up,   size=size.small)
        hiLn := line.new(startBar, hi, bar_index, hi, xloc.bar_index, extend=extend.right, color=col, width=wid, style=line.style_dashed)
        loLn := line.new(startBar, lo, bar_index, lo, xloc.bar_index, extend=extend.right, color=col, width=wid, style=line.style_dashed)

    // A session window only registers if some bar OPENS inside it. On coarse
    // timeframes (3h/4h) a 2-hour window can contain zero bar opens, and the
    // session silently never fires — which reads as "the toggle does nothing".
    // Which sessions are affected shifts with DST, so say so explicitly.
    // `barstate.islast` is true on every bar while it is forming, and the label
    // is committed when that bar closes — so it must be deleted before redrawing
    // or one warning label accumulates per bar.
    if barstate.islast and show and na(hi)
        label.delete(warnLbl)
        warnLbl := label.new(bar_index, close, "⚠ " + name + ": no bar opens inside this session on the " + timeframe.period + " timeframe. Use 30m or lower.", yloc=yloc.price, color=color.orange, textcolor=color.white, style=label.style_label_left, size=size.small)

    [hi, lo, hiBar, loBar]

// ======== The four sessions ========
[londonHigh, londonLow, londonHighBar, londonLowBar] =
  trackSession(londonSession, showLondon, londonColor, londonWidth, "London Open Killzone")

[newYorkHigh, newYorkLow, newYorkHighBar, newYorkLowBar] =
  trackSession(newYorkSession, showNewYork, newYorkColor, newYorkWidth, "New York AM Killzone")

[asiaHigh, asiaLow, asiaHighBar, asiaLowBar] =
  trackSession(asianRangeSession, showAsia, asiaColor, asiaWidth, "Asian Range")

[londonCloseHigh, londonCloseLow, londonCloseHighBar, londonCloseLowBar] =
  trackSession(londonCloseSession, showLondonClose, londonCloseColor, londonCloseWidth, "London Close Killzone")

// ======== Test hooks — hidden from the chart and the Data Window ========
// Read by tests.mjs to reconcile against independently computed ground truth.
plot(londonHigh,         "london_hi",         display=display.none)
plot(londonLow,          "london_lo",         display=display.none)
plot(londonHighBar,      "london_hiBar",      display=display.none)
plot(londonLowBar,       "london_loBar",      display=display.none)
plot(newYorkHigh,        "newYork_hi",        display=display.none)
plot(newYorkLow,         "newYork_lo",        display=display.none)
plot(newYorkHighBar,     "newYork_hiBar",     display=display.none)
plot(newYorkLowBar,      "newYork_loBar",     display=display.none)
plot(asiaHigh,           "asia_hi",           display=display.none)
plot(asiaLow,            "asia_lo",           display=display.none)
plot(asiaHighBar,        "asia_hiBar",        display=display.none)
plot(asiaLowBar,         "asia_loBar",        display=display.none)
plot(londonCloseHigh,    "londonClose_hi",    display=display.none)
plot(londonCloseLow,     "londonClose_lo",    display=display.none)
plot(londonCloseHighBar, "londonClose_hiBar", display=display.none)
plot(londonCloseLowBar,  "londonClose_loBar", display=display.none)

Overview

Session Highs and Lows Indicator (SMC Sessions, DST-safe) tracks the Asian range, London open, New York morning, and London close using America/New_York session windows so daylight saving shifts stay aligned. When each window ends, it draws a colored high line and low line with labels. Users can hide any session and change its color, width, and time range. It refuses daily and higher timeframes and does not issue entries or exits.

Details

Published by

tc3oliver on GitHub

Type

Indicator, Pine Script v6

Draws

On the price chart

Category

Sessions & time, SMC / ICT / price action, Support & resistance

Markets

Any symbol

Timeframes

M1-M5, M15-H1, H4 and above

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.

Topics

algorithmic-tradingictpine-scriptpinescriptsmctrading-indicatortradingview

Settings

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

SettingTypeDefaultVariable
Show London Open KillzonebooltrueshowLondon
Show New York AM KillzonebooltrueshowNewYork
Show Asian RangebooltrueshowAsia
Show London Close KillzonebooltrueshowLondonClose
London Open Line Colorcolorcolor.new(#47abfd, 70)londonColor
London Open Line Widthint1londonWidth
New York AM Line Colorcolorcolor.new(#ff6565, 70)newYorkColor
New York AM Line Widthint1newYorkWidth
London Close Line Colorcolorcolor.new(#ff9f43, 70)londonCloseColor
London Close Line Widthint1londonCloseWidth
Asian Range Line Colorcolorcolor.new(#75ff79, 70)asiaColor
Asian Range Line Widthint1asiaWidth
Show all 16 settings
SettingTypeDefaultVariable
Asian Range [NY time]session2000-0000asianRangeSession
London Open [NY time]session0300-0500londonSession
New York AM [NY time]session0830-1100newYorkSession
London Close [NY time]session1000-1200londonCloseSession
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

Golden Bullet Strategy

by TradersPost
218 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

This indicator detects and draws the first Fair Value Gap (FVG) that forms in each hourly session based on a selected lower timeframe, with specialized handling for Regular Trading Hours (RTH) confluence windows. It draws FVG range boxes, midpoint lines, hourl

Indicator v5 SMC / ICT / price actionSupport & resistance Repaints

This indicator combines six trading tools into a single chart overlay to optimize indicator limits. It calculates Bollinger Bands, projects weekend price boundaries, plots market structure elements like order blocks, breaker blocks, and MSB lines, marks New Yo

Indicator v6 Support & resistanceSMC / ICT / price action Repaints
19 stars

This indicator highlights Inner Circle Trader (ICT) killzones and key session pivot points directly on the price chart. It projects shaded boxes for specific trading sessions, including Asia, London, NY AM, NY Lunch, and NY PM, to help traders identify high-li

Indicator v5 SMC / ICT / price actionSessions & time
Updated 3 years ago · MIT GitHub repository of ICT Killzones & Pivots

Bandz Session Ranges + ORG + Opening Prices plots trading session ranges, killzones, opening RTH gaps, standard deviation projections, and key opening prices directly on the price chart. It calculates gap ranges based on prior regular trading hours close sourc

Indicator v6 Sessions & timeSupport & resistance
Updated 2 weeks ago · MPL-2.0 GitHub repository of Bandz Session Ranges + ORG + Opening Prices

More indicators

Trade Your Charts With a Regulated Broker

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

Compare brokers