Indicator · Pine Script v5 · On the chart

Hourly Time Levels

by TamaraKGreen· code credited to lucymatos

Hourly Time Levels plots opening price horizontal lines and text labels at specific user-selected times of the trading day directly on the main price chart.

View on GitHub

GitHub stars46on the repository
Pine versionv5runs as is
Lines of code155
Settings38inputs
LicenceNone statedfile: MPL-2.0
Last update7 weeks ago4 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

155 lines of Pine Script v5 from Hourly Time Levels.txt, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.

Hourly Time Levels.txt
// This Pine Script® code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © lucymatos

//@version=5
indicator("Hourly time levels", overlay=true)

// === User Inputs ===
var grp1 = 'Show - Hour - Label Text - Color'

// Manual Time Offset (Adjust for alignment)
offsetHours = input.int(-7, title="Manual Time Offset (Hours, adjust for alignment)")

// Time Settings for TAPDA Hours
showMidnight = input.bool(true, title='Show Midnight', inline='1', group=grp1)
colorMidnight = input.color(color.red, title='Midnight Line Color', inline='1', group=grp1)
midnightText = input.string("12:00 AM Open", title='', inline='1', group=grp1)

show2AM = input.bool(true, title='Show 2:00 AM', inline='2', group=grp1)
color2AM = input.color(color.blue, title='2:00 AM Line Color', inline='2', group=grp1)
twoAMText = input.string("2:00 AM Open", title='', inline='2', group=grp1)

show4AM = input.bool(true, title='Show 4:00 AM', inline='3', group=grp1)
color4AM = input.color(color.yellow, title='4:00 AM Line Color', inline='3', group=grp1)
fourAMText = input.string("4:00 AM Open", title='', inline='3', group=grp1)

show430AM = input.bool(true, title='Show 4:30 AM', inline='4', group=grp1)
color430AM = input.color(color.teal, title='4:30 AM Line Color', inline='4', group=grp1)
four30AMText = input.string("4:30 AM Open", title='', inline='4', group=grp1)

show7AM = input.bool(true, title='Show 7:00 AM', inline='5', group=grp1)
color7AM = input.color(color.fuchsia, title='7:00 AM Line Color', inline='5', group=grp1)
sevenAMText = input.string("7:00 AM Open", title='', inline='5', group=grp1)

show8AM = input.bool(true, title='Show 8:00 AM', inline='6', group=grp1)
color8AM = input.color(color.lime, title='8:00 AM Line Color', inline='6', group=grp1)
eightAMText = input.string("8:00 AM Open", title='', inline='6', group=grp1)

show9AM = input.bool(true, title='Show 9:00 AM', inline='7', group=grp1)
color9AM = input.color(color.green, title='9:00 AM Line Color', inline='7', group=grp1)
nineAMText = input.string("9:00 AM Open", title='', inline='7', group=grp1)

show930AM = input.bool(true, title='Show 9:30 AM', inline='8', group=grp1)
color930AM = input.color(color.orange, title='9:30 AM Line Color', inline='8', group=grp1)
nine30Text = input.string("9:30 AM Open", title='', inline='8', group=grp1)

show10AM = input.bool(true, title='Show 10:00 AM', inline='9', group=grp1)
color10AM = input.color(color.aqua, title='10:00 AM Line Color', inline='9', group=grp1)
tenAMText = input.string("10:00 AM Open", title='', inline='9', group=grp1)

show2PM = input.bool(true, title='Show 2:00 PM', inline='10', group=grp1)
color2PM = input.color(color.purple, title='2:00 PM Line Color', inline='10', group=grp1)
twoPMText = input.string("2:00 PM Open", title='', inline='10', group=grp1)

show4PM = input.bool(true, title='Show 4:00 PM', inline='11', group=grp1)
color4PM = input.color(color.gray, title='4:00 PM Line Color', inline='11', group=grp1)
fourPMText = input.string("4:00 PM Open", title='', inline='11', group=grp1)

// === Other Settings ===
var grp2 = 'Other Settings'
MAX_LINES = input.int(10, title='Max Lines to show', minval=0, maxval=200, group=grp2)
extendHours = input.int(24, title='Extend lines for how many hours?', minval=1, maxval=24, group=grp2)
linesWidth = input.int(1, title='Lines Width', minval=1, maxval=4, group=grp2)
_labelSize = input.string("Tiny", title='Label Size', options=['Auto', 'Tiny', 'Small', 'Normal', 'Huge'], group=grp2)

labelSize = _labelSize == "Auto" ? size.auto : _labelSize == "Tiny" ? size.tiny : _labelSize == "Small" ? size.small : _labelSize == "Normal" ? size.normal : size.huge

// === Line and Label Arrays ===
var line[] linesTop = array.new_line(0)
var line[] linesBottom = array.new_line(0)
var label[] labels = array.new_label(0)

// === Projection Calculation ===
_extend = extendHours * 3600000

// === Calculate New York Time with Offset ===
nyTime = timestamp("GMT" + str.tostring(offsetHours), year, month, dayofmonth, hour, minute)

// Get New York hour and minute for time checks
nyHour = hour(nyTime)
nyMinute = minute(nyTime)

// === Time Conditions with Adjusted Time ===
inMidnight = nyHour == 0 and nyMinute == 0
in2AM = nyHour == 2 and nyMinute == 0
in4AM = nyHour == 4 and nyMinute == 0
in430AM = nyHour == 4 and nyMinute == 30
in7AM = nyHour == 7 and nyMinute == 0
in8AM = nyHour == 8 and nyMinute == 0
in9AM = nyHour == 9 and nyMinute == 0
in930AM = nyHour == 9 and nyMinute == 30
in10AM = nyHour == 10 and nyMinute == 0
in2PM = nyHour == 14 and nyMinute == 0
in4PM = nyHour == 16 and nyMinute == 0

// === Plotting Candle Body Boxes (Top and Bottom Lines) ===
if inMidnight and not inMidnight[1] and showMidnight
    array.push(linesTop, line.new(time, open, time + _extend, open, xloc=xloc.bar_time, color=colorMidnight, width=linesWidth))
    array.push(linesBottom, line.new(time, close, time + _extend, close, xloc=xloc.bar_time, color=colorMidnight, width=linesWidth))
    array.push(labels, label.new(time + _extend, open, midnightText, xloc=xloc.bar_time, style=label.style_none, size=labelSize, textcolor=colorMidnight))

if in2AM and not in2AM[1] and show2AM
    array.push(linesTop, line.new(time, open, time + _extend, open, xloc=xloc.bar_time, color=color2AM, width=linesWidth))
    array.push(linesBottom, line.new(time, close, time + _extend, close, xloc=xloc.bar_time, color=color2AM, width=linesWidth))
    array.push(labels, label.new(time + _extend, open, twoAMText, xloc=xloc.bar_time, style=label.style_none, size=labelSize, textcolor=color2AM))

if in4AM and not in4AM[1] and show4AM
    array.push(linesTop, line.new(time, open, time + _extend, open, xloc=xloc.bar_time, color=color4AM, width=linesWidth))
    array.push(linesBottom, line.new(time, close, time + _extend, close, xloc=xloc.bar_time, color=color4AM, width=linesWidth))
    array.push(labels, label.new(time + _extend, open, fourAMText, xloc=xloc.bar_time, style=label.style_none, size=labelSize, textcolor=color4AM))

if in430AM and not in430AM[1] and show430AM
    array.push(linesTop, line.new(time, open, time + _extend, open, xloc=xloc.bar_time, color=color430AM, width=linesWidth))
    array.push(linesBottom, line.new(time, close, time + _extend, close, xloc=xloc.bar_time, color=color430AM, width=linesWidth))
    array.push(labels, label.new(time + _extend, open, four30AMText, xloc=xloc.bar_time, style=label.style_none, size=labelSize, textcolor=color430AM))

if in7AM and not in7AM[1] and show7AM
    array.push(linesTop, line.new(time, open, time + _extend, open, xloc=xloc.bar_time, color=color7AM, width=linesWidth))
    array.push(linesBottom, line.new(time, close, time + _extend, close, xloc=xloc.bar_time, color=color7AM, width=linesWidth))
    array.push(labels, label.new(time + _extend, open, sevenAMText, xloc=xloc.bar_time, style=label.style_none, size=labelSize, textcolor=color7AM))

if in8AM and not in8AM[1] and show8AM
    array.push(linesTop, line.new(time, open, time + _extend, open, xloc=xloc.bar_time, color=color8AM, width=linesWidth))
    array.push(linesBottom, line.new(time, close, time + _extend, close, xloc=xloc.bar_time, color=color8AM, width=linesWidth))
    array.push(labels, label.new(time + _extend, open, eightAMText, xloc=xloc.bar_time, style=label.style_none, size=labelSize, textcolor=color8AM))

if in9AM and not in9AM[1] and show9AM
    array.push(linesTop, line.new(time, open, time + _extend, open, xloc=xloc.bar_time, color=color9AM, width=linesWidth))
    array.push(linesBottom, line.new(time, close, time + _extend, close, xloc=xloc.bar_time, color=color9AM, width=linesWidth))
    array.push(labels, label.new(time + _extend, open, nineAMText, xloc=xloc.bar_time, style=label.style_none, size=labelSize, textcolor=color9AM))

if in930AM and not in930AM[1] and show930AM
    array.push(linesTop, line.new(time, open, time + _extend, open, xloc=xloc.bar_time, color=color930AM, width=linesWidth))
    array.push(linesBottom, line.new(time, close, time + _extend, close, xloc=xloc.bar_time, color=color930AM, width=linesWidth))
    array.push(labels, label.new(time + _extend, open, nine30Text, xloc=xloc.bar_time, style=label.style_none, size=labelSize, textcolor=color930AM))

if in10AM and not in10AM[1] and show10AM
    array.push(linesTop, line.new(time, open, time + _extend, open, xloc=xloc.bar_time, color=color10AM, width=linesWidth))
    array.push(linesBottom, line.new(time, close, time + _extend, close, xloc=xloc.bar_time, color=color10AM, width=linesWidth))
    array.push(labels, label.new(time + _extend, open, tenAMText, xloc=xloc.bar_time, style=label.style_none, size=labelSize, textcolor=color10AM))

if in2PM and not in2PM[1] and show2PM
    array.push(linesTop, line.new(time, open, time + _extend, open, xloc=xloc.bar_time, color=color2PM, width=linesWidth))
    array.push(linesBottom, line.new(time, close, time + _extend, close, xloc=xloc.bar_time, color=color2PM, width=linesWidth))
    array.push(labels, label.new(time + _extend, open, twoPMText, xloc=xloc.bar_time, style=label.style_none, size=labelSize, textcolor=color2PM))

if in4PM and not in4PM[1] and show4PM
    array.push(linesTop, line.new(time, open, time + _extend, open, xloc=xloc.bar_time, color=color4PM, width=linesWidth))
    array.push(linesBottom, line.new(time, close, time + _extend, close, xloc=xloc.bar_time, color=color4PM, width=linesWidth))
    array.push(labels, label.new(time + _extend, open, fourPMText, xloc=xloc.bar_time, style=label.style_none, size=labelSize, textcolor=color4PM))

// === Cleanup Old Lines ===
if array.size(linesTop) > MAX_LINES
    line.delete(array.shift(linesTop))
    line.delete(array.shift(linesBottom))
    label.delete(array.shift(labels))

Overview

Hourly Time Levels marks key intraday timestamps such as midnight, market opens, and specific hourly intervals including 2:00 AM, 4:30 AM, and 9:30 AM. Users can adjust a manual UTC offset to align times correctly to their exchange, toggle individual time levels, customize line colors and labels, and control line extension durations.

Details

Published by

TamaraKGreen on GitHub

Code credit

lucymatos, as written in the script's header

Type

Indicator, Pine Script v5

Draws

On the price chart

Category

Support & resistance, Sessions & time

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
Manual Time Offset (Hours, adjust for alignment)int-7offsetHours
Show MidnightbooltrueshowMidnight
Midnight Line Colorcolorcolor.redcolorMidnight
midnightTextstring12:00 AM OpenmidnightText
Show 2:00 AMbooltrueshow2AM
2:00 AM Line Colorcolorcolor.bluecolor2AM
twoAMTextstring2:00 AM OpentwoAMText
Show 4:00 AMbooltrueshow4AM
4:00 AM Line Colorcolorcolor.yellowcolor4AM
fourAMTextstring4:00 AM OpenfourAMText
Show 4:30 AMbooltrueshow430AM
4:30 AM Line Colorcolorcolor.tealcolor430AM
Show all 38 settings
SettingTypeDefaultVariable
four30AMTextstring4:30 AM Openfour30AMText
Show 7:00 AMbooltrueshow7AM
7:00 AM Line Colorcolorcolor.fuchsiacolor7AM
sevenAMTextstring7:00 AM OpensevenAMText
Show 8:00 AMbooltrueshow8AM
8:00 AM Line Colorcolorcolor.limecolor8AM
eightAMTextstring8:00 AM OpeneightAMText
Show 9:00 AMbooltrueshow9AM
9:00 AM Line Colorcolorcolor.greencolor9AM
nineAMTextstring9:00 AM OpennineAMText
Show 9:30 AMbooltrueshow930AM
9:30 AM Line Colorcolorcolor.orangecolor930AM
nine30Textstring9:30 AM Opennine30Text
Show 10:00 AMbooltrueshow10AM
10:00 AM Line Colorcolorcolor.aquacolor10AM
tenAMTextstring10:00 AM OpentenAMText
Show 2:00 PMbooltrueshow2PM
2:00 PM Line Colorcolorcolor.purplecolor2PM
twoPMTextstring2:00 PM OpentwoPMText
Show 4:00 PMbooltrueshow4PM
4:00 PM Line Colorcolorcolor.graycolor4PM
fourPMTextstring4:00 PM OpenfourPMText
Max Lines to showint10MAX_LINES
Extend lines for how many hours?int24extendHours
Lines Widthint1linesWidth
Label SizestringTiny_labelSize
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