Indicator · Pine Script v5 · On the chart

Daily Levels

by g-moe· code credited to goodgains

Daily Levels plots horizontal price offset lines based on the current day's open and previous day's close.

View on GitHub

Repaints

GitHub stars3on the repository
Pine versionv5runs as is
Lines of code60
Settings9inputs
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

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

daily-levels.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("Daily Levels", overlay = true)

// @keywords: daily-levels, today-open, yesterday-close, add-on-offset, horizontal-level, daily-timeframe, previous-days, extend-today, premarket-hide, day-change, opening-level, closing-level, offset-lines, yc0-level, yc1-level, session-levels, daily-reference, level-plot, line-extension, intraday-levels

hide_on_daily = timeframe.isdwm ? true : false

//inputs
timeframe = input.timeframe('D', title = 'Time Period', group = 'Settings')
add_on_one = input.float(5.00, title = 'Add On #1', group = 'Settings')
add_on_two = input.float(10.00, title = 'Add On #2', group = 'Settings')
show_previous_days = input.bool(true, title = 'Show Previous Days', group = 'Settings')
extend_today = input.bool(false, title = 'Extend Today Across Chart', group = 'Settings')

// barcolor(session.ispremarket ? color.yellow : color.black)

todays_o = request.security(syminfo.tickerid, timeframe, open, lookahead = barmerge.lookahead_on)
todays_c = request.security(syminfo.tickerid, timeframe, close, lookahead = barmerge.lookahead_on) //because it doesnt plot on PM correctly
yesterdays_c = request.security(syminfo.tickerid, timeframe, close[1], lookahead = barmerge.lookahead_on)

today_open = session.ispremarket ? na : todays_o
y_close = session.ispremarket ? todays_c : yesterdays_c

plot_cond = not hide_on_daily and show_previous_days

//colors
one_color = input.color(color.new(color.yellow,0), title = 'One Color', group = 'Visual Settings')
two_color = input.color(color.new(color.yellow,0), title = 'Two Color', group = 'Visual Settings')

yc0_color = input.color(color.new(color.orange,0), title = 'yc0 Color', group = 'Visual Settings')
yc1_color = input.color(color.new(color.orange,0), title = 'yc1 Color', group = 'Visual Settings')

new_day = dayofmonth != dayofmonth[1]


//plots
one_plot = plot(plot_cond ? today_open + add_on_one : na, title = 'One', style = plot.style_linebr, color=session.ispremarket or new_day ? color.new(#000000,100) : one_color, editable = false)
two_plot = plot(plot_cond ? today_open + add_on_two : na, title = 'Two', style = plot.style_linebr, color=session.ispremarket or new_day ? color.new(#000000,100) : two_color, editable = false)

yc0_plot = plot(plot_cond ? y_close + add_on_one : na, title = 'yC0', style = plot.style_linebr, color= new_day ? color.new(#000000,100) : yc0_color, editable = false)
yc1_plot = plot(plot_cond ? y_close + add_on_two : na, title = 'yC1', style = plot.style_linebr, color= new_day ? color.new(#000000,100) : yc1_color, editable = false)


if extend_today

    one_line = line.new(x1=bar_index - 10, x2=bar_index, y1=today_open + add_on_one, y2=today_open + add_on_one, xloc=xloc.bar_index, width=1, color=one_color, extend=extend.both, style=line.style_solid)
    line.delete(one_line[1])
    
    two_line = line.new(x1=bar_index - 10, x2=bar_index, y1=today_open + add_on_two, y2=today_open + add_on_two, xloc=xloc.bar_index, width=1, color=two_color, extend=extend.both, style=line.style_solid)
    line.delete(two_line[1])

    yc0_line = line.new(x1=bar_index - 10, x2=bar_index, y1=y_close + add_on_one, y2=y_close + add_on_one, xloc=xloc.bar_index, width=1, color=yc0_color, extend=extend.both, style=line.style_solid)
    line.delete(yc0_line[1])

    yc1_line = line.new(x1=bar_index - 10, x2=bar_index, y1=y_close + add_on_two, y2=y_close + add_on_two, xloc=xloc.bar_index, width=1, color=yc1_color, extend=extend.both, style=line.style_solid)
    line.delete(yc1_line[1])

Overview

Users can define two custom price offsets to project key reference levels above opening and closing values. The indicator renders directly on the price chart and offers toggles to display historical daily levels or extend current lines across the screen. Because it uses daily security calls with lookahead enabled, historical bars experience lookahead bias.

Details

Published by

g-moe on GitHub

Code credit

goodgains, as written in the script's header

Draws

On the price chart

Markets

Any symbol

Timeframes

M1-M5, M15-H1

Risk Notes

  • Signals can change on the live bar or after it closes (repainting)
  • Reads higher-timeframe data with lookahead on, so the history can show signals that were not there in real time

Settings

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

SettingTypeDefaultVariable
Time PeriodtimeframeDtimeframe
Add On #1float5.00add_on_one
Add On #2float10.00add_on_two
Show Previous Daysbooltrueshow_previous_days
Extend Today Across Chartboolfalseextend_today
One Colorcolorcolor.new(color.yellow,0)one_color
Two Colorcolorcolor.new(color.yellow,0)two_color
yc0 Colorcolorcolor.new(color.orange,0)yc0_color
yc1 Colorcolorcolor.new(color.orange,0)yc1_color
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 Support & resistance 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