Indicator · Pine Script v5 · On the chart

Sessions Toolbox

by g-moe· code credited to goodgains

Sessions Toolbox overlays key intraday trading sessions—Asia, Euro, and USA—directly on the price chart.

View on GitHub

GitHub stars3on the repository
Pine versionv5runs as is
Lines of code160
Settings25inputs
LicenceNone statedfile: MPL-2.0
Last update5 months ago27 May 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

160 lines of Pine Script v5 from Tradingview/sessions-toolbox.pine, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.

sessions-toolbox.pine
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © goodgains


//@version=5
indicator("🧰 Sessions Toolbox", overlay = true, max_lines_count = 500)

// @keywords: sessions-toolbox, asia-session, euro-session, usa-session, session-vwap, session-high, session-low, session-open, session-close, session-background, full-day-vwap, vwap-bands, session-markers, intraday-sessions, session-ohlc, timezone-est, session-divider, vwap-deviation, open-close-dots, session-toolbox

if timeframe.isdwm or (timeframe.multiplier > 30)
    runtime.error('The Sessions Toolbox is designed to only work on intraday charts of 30 minutes or less.')

//
//SESSION SETTINGS
//
default_color = input.color(color.new(#9598a1,0), title = 'Default Color', group = 'Session Settings', inline = '4')
asia_color = input.color(color.new(#ff0014,0), title = 'Asia Session', group = 'Session Settings', inline = '5')
asia_time = input.session("2000-0259", title = '', group = 'Session Settings', inline = '5')
euro_color = input.color(color.new(#ffe500,0), title = 'Euro Session', group = 'Session Settings', inline = '6')
euro_time = input.session("0300-0929", title = '', group = 'Session Settings', inline = '6')
usa_color = input.color(color.new(#005eff,0), title = 'USA Session', group = 'Session Settings', inline = '7')
usa_time = input.session("0930-1959", title = '', group = 'Session Settings', inline = '7')

is_asia = time(timeframe.period, asia_time, "America/New_York")
is_euro = time(timeframe.period, euro_time, "America/New_York")
is_usa = time(timeframe.period, usa_time, "America/New_York")

day_change = ta.change(time("D"))
asia_change = is_asia and not is_asia[1]
euro_change = is_euro and not is_euro[1]
usa_change = is_usa and not is_usa[1]

//
//SESSION HIGH-LOW
//
color_session_bg = input.bool(true, title = 'Color Session Background', group = 'OHLC Settings', inline = '1')
show_open_close = input.bool(true, title = 'Show Open/Close Plots', group = 'OHLC Settings', inline = '2')
show_asia = input.bool(true, title = 'Show Asia', group = 'OHLC Settings', inline = '3')
show_euro = input.bool(true, title = 'Show Euro', group = 'OHLC Settings', inline = '4')
show_usa = input.bool(true, title = 'Show USA', group = 'OHLC Settings', inline = '5')

//OPENS
plotchar(show_open_close and asia_change ? open : na, title = 'Asia Open', char = '●' , color = asia_color, location = location.absolute, size = size.tiny, editable = false)
plotchar(show_open_close and euro_change ? open : na, title = 'Euro Open', char = '●' , color = euro_color, location = location.absolute, size = size.tiny, editable = false)
plotchar(show_open_close and usa_change ? open : na, title = 'USA Open', char = '●' , color = usa_color, location = location.absolute, size = size.tiny, editable = false)

//CLOSES
plotchar(show_open_close and not is_asia and is_asia[1] ? close[1] : na, title = 'Asia Open', char = '●' , color = asia_color, location = location.absolute, size = size.tiny, editable = false, offset = -1)
plotchar(show_open_close and not is_euro and is_euro[1] ? close[1] : na, title = 'Euro Open', char = '●' , color = euro_color, location = location.absolute, size = size.tiny, editable = false, offset = -1)
plotchar(show_open_close and not is_usa and is_usa[1] ? close[1] : na, title = 'USA Open', char = '●' , color = usa_color, location = location.absolute, size = size.tiny, editable = false, offset = -1)

draw_lines(show_lines, is_session, change, linecolor) =>

    var start_bn = 0
    start_bn := change ? bar_index : start_bn[1]    

    var high_value = 0.00
    high_value := change ? high : is_session and high > high_value[1] ? high : high_value[1]
    
    var low_value = 0.00
    low_value := change ? low : is_session and low < low_value[1] ? low : low_value[1]

    if is_session and show_lines
        high_line = line.new(start_bn, high_value, bar_index, high_value, xloc = xloc.bar_index, extend = extend.none, color = linecolor, style = line.style_solid, width = 1 )
        low_line = line.new(start_bn, low_value, bar_index, low_value, xloc = xloc.bar_index, extend = extend.none, color = linecolor, style = line.style_solid, width = 1 )
        line_fill = linefill.new(high_line, low_line, color = color_session_bg ? color.new(linecolor,90) : na)
        
        if not change
            line.delete(high_line[1])
            line.delete(low_line[1])

draw_lines(show_asia, is_asia, asia_change, asia_color)
draw_lines(show_euro, is_euro, euro_change, euro_color)
draw_lines(show_usa, is_usa, usa_change, usa_color)


//
//VWAP
//
//VWAP FUNCTION
vwap_function(src, isNewPeriod, stDevMult_1, stDevMult_2) =>
    var float sumSrcVol = na
    var float sumVol = na
    var float sumSrcSrcVol = na
    
    sumSrcVol := isNewPeriod ? src * volume : src * volume + sumSrcVol[1]
    sumVol := isNewPeriod ? volume : volume + sumVol[1]
    sumSrcSrcVol := isNewPeriod ? volume * math.pow(src, 2) : volume * math.pow(src, 2) + sumSrcSrcVol[1]
    _vwap = sumSrcVol / sumVol
    
    variance = sumSrcSrcVol / sumVol - math.pow(_vwap, 2)
    variance := variance < 0 ? 0 : variance
    stDev = math.sqrt(variance)

    lowerBand = _vwap - stDev * stDevMult_1
    upperBand = _vwap + stDev * stDevMult_1
    
    lowerBand2 = _vwap - stDev * stDevMult_2
    upperBand2 = _vwap + stDev * stDevMult_2

    [_vwap, lowerBand, upperBand, lowerBand2, upperBand2]
    
    
show_full_day_vwap = input.bool(false, title = 'Show Day     |     ', group = 'VWAP Settings', inline = '1')
show_full_day_bands = input.bool(false, title = 'Bands', group = 'VWAP Settings', inline = '1')

show_asia_vwap = input.bool(true, title = 'Show Asia     |     ', group = 'VWAP Settings', inline = '2')
show_asia_bands = input.bool(false, title = 'Bands     |     ', group = 'VWAP Settings', inline = '2')
show_extended_asia = input.bool(false, title = 'Extend', group = 'VWAP Settings', inline = '2')
asia_extension_cond = (show_extended_asia or not show_extended_asia and is_asia)

show_euro_vwap = input.bool(true, title = 'Show Euro     |     ', group = 'VWAP Settings', inline = '3')
show_euro_bands = input.bool(false, title = 'Bands     |     ', group = 'VWAP Settings', inline = '3')
show_extended_euro = input.bool(false, title = 'Extend', group = 'VWAP Settings', inline = '3')
euro_extension_cond = (show_extended_euro or not show_extended_euro and is_euro)

show_usa_vwap = input.bool(true, title = 'Show USA     |     ', group = 'VWAP Settings', inline = '4')
show_usa_bands = input.bool(false, title = 'Bands     |     ', group = 'VWAP Settings', inline = '4')
show_extended_usa = input.bool(false, title = 'Extend', group = 'VWAP Settings', inline = '4')
usa_extension_cond = (show_extended_usa or not show_extended_usa and is_usa)

std_dev1 = input.float(2.5, title = 'Deviations', group = 'VWAP Settings', inline = '99')
std_dev2 = input.float(3.0, title = '', group = 'VWAP Settings', inline = '99')

[_vwap, _lb, _ub, _lb2, _ub2] = vwap_function(hlc3, day_change, std_dev1, std_dev2)
[asia_vwap, asia_lb, asia_ub, asia_lb2, asia_ub2] = vwap_function(hlc3, asia_change, std_dev1, std_dev2)
[euro_vwap, euro_lb, euro_ub, euro_lb2, euro_ub2] = vwap_function(hlc3, euro_change, std_dev1, std_dev2)
[usa_vwap, usa_lb, usa_ub, usa_lb2, usa_ub2] = vwap_function(hlc3, usa_change, std_dev1, std_dev2)

_vwap_plot = plot(show_full_day_vwap ? _vwap : na, title = 'Full Day VWAP', color = day_change ? color.new(default_color,100) : default_color, editable = false)
_ub_plot = plot(show_full_day_vwap and show_full_day_bands ? _ub : na, title = 'Full Day UB', color = color.new(default_color,50), editable = false, style = plot.style_linebr)
_ub2_plot = plot(show_full_day_vwap and show_full_day_bands ? _ub2 : na, title = 'Full Day UB2', color = color.new(default_color,50), editable = false, style = plot.style_linebr)
_lb_plot = plot(show_full_day_vwap and show_full_day_bands  ? _lb : na, title = 'Full Day LB', color = color.new(default_color,50), editable = false, style = plot.style_linebr)
_lb2_plot = plot(show_full_day_vwap and show_full_day_bands  ? _lb2 : na, title = 'Full Day LB2', color = color.new(default_color,50), editable = false, style = plot.style_linebr)
fill(_ub_plot, _ub2_plot, color = day_change ? color.new(default_color,100) : color.new(default_color,80), editable = false)
fill(_lb_plot, _lb2_plot, color = day_change ? color.new(default_color,100) : color.new(default_color,80), editable = false)

asia_vwap_plot = plot(show_asia_vwap and asia_extension_cond ? asia_vwap : na, title = 'Asia VWAP', color = asia_change ? color.new(asia_color,100) : asia_color, editable = false)
asia_ub_plot = plot(show_asia_vwap and show_asia_bands and asia_extension_cond ? asia_ub : na, title = 'Asia UB', color = color.new(asia_color,50), editable = false, style = plot.style_linebr)
asia_ub2_plot = plot(show_asia_vwap and show_asia_bands and asia_extension_cond ? asia_ub2 : na, title = 'Asia UB2', color = color.new(asia_color,50), editable = false, style = plot.style_linebr)
asia_lb_plot = plot(show_asia_vwap and show_asia_bands and asia_extension_cond ? asia_lb : na, title = 'Asia LB', color = color.new(asia_color,50), editable = false, style = plot.style_linebr)
asia_lb2_plot = plot(show_asia_vwap and show_asia_bands and asia_extension_cond ? asia_lb2 : na, title = 'Asia LB2', color = color.new(asia_color,50), editable = false, style = plot.style_linebr)
fill(asia_ub_plot, asia_ub2_plot, color = asia_change ? color.new(asia_color,100) : color.new(asia_color,80), editable = false)
fill(asia_lb_plot, asia_lb2_plot, color = asia_change ? color.new(asia_color,100) : color.new(asia_color,80), editable = false)

euro_vwap_plot = plot(show_euro_vwap and euro_extension_cond ? euro_vwap : na, title = 'Euro VWAP', color = euro_change ? color.new(euro_color,100) : euro_color, editable = false)
euro_ub_plot = plot(show_euro_vwap and show_euro_bands and euro_extension_cond ? euro_ub : na, title = 'Euro UB', color = color.new(euro_color,50), editable = false, style = plot.style_linebr)
euro_ub2_plot = plot(show_euro_vwap and show_euro_bands and euro_extension_cond ? euro_ub2 : na, title = 'Euro UB2', color = color.new(euro_color,50), editable = false, style = plot.style_linebr)
euro_lb_plot = plot(show_euro_vwap and show_euro_bands and euro_extension_cond ? euro_lb : na, title = 'Euro LB', color = color.new(euro_color,50), editable = false, style = plot.style_linebr)
euro_lb2_plot = plot(show_euro_vwap and show_euro_bands and euro_extension_cond ? euro_lb2 : na, title = 'Euro LB2', color = color.new(euro_color,50), editable = false, style = plot.style_linebr)
fill(euro_ub_plot, euro_ub2_plot, color = euro_change ? color.new(euro_color,100) : color.new(euro_color,80), editable = false)
fill(euro_lb_plot, euro_lb2_plot, color = euro_change ? color.new(euro_color,100) : color.new(euro_color,80), editable = false)

usa_vwap_plot = plot(show_usa_vwap and usa_extension_cond ? usa_vwap : na, title = 'USA VWAP', color = usa_change ? color.new(usa_color,100) : usa_color, editable = false)
usa_ub_plot = plot(show_usa_vwap and show_usa_bands and usa_extension_cond ? usa_ub : na, title = 'USA UB', color = color.new(usa_color,50), editable = false, style = plot.style_linebr)
usa_ub2_plot = plot(show_usa_vwap and show_usa_bands and usa_extension_cond ? usa_ub2 : na, title = 'USA UB2', color = color.new(usa_color,50), editable = false, style = plot.style_linebr)
usa_lb_plot = plot(show_usa_vwap and show_usa_bands and usa_extension_cond ? usa_lb : na, title = 'USA LB', color = color.new(usa_color,50), editable = false, style = plot.style_linebr)
usa_lb2_plot = plot(show_usa_vwap and show_usa_bands and usa_extension_cond ? usa_lb2 : na, title = 'USA LB2', color = color.new(usa_color,50), editable = false, style = plot.style_linebr)
fill(usa_ub_plot, usa_ub2_plot, color = usa_change ? color.new(usa_color,100) : color.new(usa_color,80), editable = false)
fill(usa_lb_plot, usa_lb2_plot, color = usa_change ? color.new(usa_color,100) : color.new(usa_color,80), editable = false)

Overview

Sessions Toolbox features optional background highlighting, markers for session open and close levels, and session-specific Volume Weighted Average Price (VWAP) lines with standard deviation bands. Users can customize session time ranges, color themes, VWAP toggles, and deviation multipliers. The script is designed exclusively for intraday charts of 30 minutes or less.

Details

Published by

g-moe on GitHub

Code credit

goodgains, as written in the script's header

Type

Indicator, Pine Script v5

Draws

On the price chart

Category

Sessions & time, Support & resistance

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
Default Colorcolorcolor.new(#9598a1,0)default_color
Asia Sessioncolorcolor.new(#ff0014,0)asia_color
asia_timesession2000-0259asia_time
Euro Sessioncolorcolor.new(#ffe500,0)euro_color
euro_timesession0300-0929euro_time
USA Sessioncolorcolor.new(#005eff,0)usa_color
usa_timesession0930-1959usa_time
Color Session Backgroundbooltruecolor_session_bg
Show Open/Close Plotsbooltrueshow_open_close
Show Asiabooltrueshow_asia
Show Eurobooltrueshow_euro
Show USAbooltrueshow_usa
Show all 25 settings
SettingTypeDefaultVariable
Show Day | boolfalseshow_full_day_vwap
Bandsboolfalseshow_full_day_bands
Show Asia | booltrueshow_asia_vwap
Bands | boolfalseshow_asia_bands
Extendboolfalseshow_extended_asia
Show Euro | booltrueshow_euro_vwap
Bands | boolfalseshow_euro_bands
Extendboolfalseshow_extended_euro
Show USA | booltrueshow_usa_vwap
Bands | boolfalseshow_usa_bands
Extendboolfalseshow_extended_usa
Deviationsfloat2.5std_dev1
std_dev2float3.0std_dev2
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 6 weeks ago · None stated GitHub repository of Auto Trade Futures ES
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 昨日高低點標示

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

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 8 weeks 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 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