Indicator · Pine Script v6 · On the chart

Static Lines

by lunarticktrading· code credited to gambcl

Static Lines calculates and draws key daily price levels directly on the main price chart.

View on GitHub

Repaints

GitHub stars7on the repository
Pine versionv6current
Lines of code121
Settings11inputs
LicenceNone statedfile: MPL-2.0
Last update2 weeks ago10 Oct 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

121 lines of Pine Script v6 from Static Lines.txt, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.

Static Lines.txt
// This Pine Script® code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © gambcl

//@version=6
indicator("Static Lines", overlay = true)


////////////////////////////////////////////////////////////////////////////////////////////////////
// Version History
////////////////////////////////////////////////////////////////////////////////////////////////////
// v1.0.0
// - Initial release
////////////////////////////////////////////////////////////////////////////////////////////////////
// This indicator shows the "Static Lines" as used by Bob Anderson in his Goldline/Redline strategy.
// https://youtu.be/KkZ42sWK9ck?si=vlbSnwVf8TtriySm
////////////////////////////////////////////////////////////////////////////////////////////////////


////////////////////////////////////////////////////////////////////////////////
// Constants
////////////////////////////////////////////////////////////////////////////////

var PDO = "PDO"
var PDH = "PDH"
var PDL = "PDL"
var PDC = "PDC"
var DO = "DO"


////////////////////////////////////////////////////////////////////////////////
// Inputs
////////////////////////////////////////////////////////////////////////////////

bool i_show_prev_daily_open = input.bool(true, "Previous Daily Open", inline = PDO)
color i_prev_daily_open_color = input.color(color.blue, "", inline = PDO)

bool i_show_prev_daily_high = input.bool(true, "Previous Daily High", inline = PDH)
color i_prev_daily_high_color = input.color(color.green, "", inline = PDH)

bool i_show_prev_daily_low = input.bool(true, "Previous Daily Low", inline = PDL)
color i_prev_daily_low_color = input.color(color.red, "", inline = PDL)

bool i_show_prev_daily_close = input.bool(true, "Previous Daily Close", inline = PDC)
color i_prev_daily_close_color = input.color(color.gray, "", inline = PDC)

bool i_show_daily_open = input.bool(true, "Daily Open", inline = DO)
color i_daily_open_color = input.color(color.aqua, "", inline = DO)

bool i_show_labels = input.bool(true, "Show Labels")


////////////////////////////////////////////////////////////////////////////////
// Data Series
////////////////////////////////////////////////////////////////////////////////

varip float prev_daily_open = na
varip float prev_daily_high = na
varip float prev_daily_low = na
varip float prev_daily_close = na
varip float daily_open = na
varip float daily_high = na
varip float daily_low = na
varip float daily_close = na


////////////////////////////////////////////////////////////////////////////////
// Labels
////////////////////////////////////////////////////////////////////////////////

var label prev_daily_open_label = i_show_prev_daily_open and i_show_labels ? label.new(bar_index + 1, prev_daily_open, "PDO", xloc.bar_index, yloc.price, color.new(color.black, 100), label.style_label_left, i_prev_daily_open_color, size.normal, text.align_left, "Previous Daily Open") : na
var label prev_daily_high_label = i_show_prev_daily_high and i_show_labels ? label.new(bar_index + 1, prev_daily_open, "PDH", xloc.bar_index, yloc.price, color.new(color.black, 100), label.style_label_left, i_prev_daily_high_color, size.normal, text.align_left, "Previous Daily High") : na
var label prev_daily_low_label = i_show_prev_daily_low and i_show_labels ? label.new(bar_index + 1, prev_daily_open, "PDL", xloc.bar_index, yloc.price, color.new(color.black, 100), label.style_label_left, i_prev_daily_low_color, size.normal, text.align_left, "Previous Daily Low") : na
var label prev_daily_close_label = i_show_prev_daily_close and i_show_labels ? label.new(bar_index + 1, prev_daily_open, "PDC", xloc.bar_index, yloc.price, color.new(color.black, 100), label.style_label_left, i_prev_daily_close_color, size.normal, text.align_left, "Previous Daily Close") : na
var label daily_open_label = i_show_daily_open and i_show_labels ? label.new(bar_index + 1, prev_daily_open, "DO", xloc.bar_index, yloc.price, color.new(color.black, 100), label.style_label_left, i_daily_open_color, size.normal, text.align_left, "Daily Open") : na


////////////////////////////////////////////////////////////////////////////////
// Calculations
////////////////////////////////////////////////////////////////////////////////

if barstate.isnew and session.isfirstbar
    // Session rollover
    prev_daily_open := daily_open
    prev_daily_high := daily_high
    prev_daily_low := daily_low
    prev_daily_close := daily_close
    daily_open := open
    daily_high := high
    daily_low := low
    daily_close := close

daily_high := math.max(daily_high, high)
daily_low := math.min(daily_low, low)
daily_close := close

if i_show_labels
    prev_daily_open_label.set_x(bar_index + 1)
    prev_daily_open_label.set_y(prev_daily_open)

    prev_daily_high_label.set_x(bar_index + 1)
    prev_daily_high_label.set_y(prev_daily_high)

    prev_daily_low_label.set_x(bar_index + 1)
    prev_daily_low_label.set_y(prev_daily_low)

    prev_daily_close_label.set_x(bar_index + 1)
    prev_daily_close_label.set_y(prev_daily_close)

    daily_open_label.set_x(bar_index + 1)
    daily_open_label.set_y(daily_open)


////////////////////////////////////////////////////////////////////////////////
// Plots
////////////////////////////////////////////////////////////////////////////////

plot(session.islastbar or not i_show_prev_daily_open ? na : prev_daily_open, "Prev Daily Open", i_prev_daily_open_color, 2, plot.style_linebr, linestyle = plot.linestyle_dashed)
plot(session.islastbar or not i_show_prev_daily_high ? na : prev_daily_high, "Prev Daily High", i_prev_daily_high_color, 2, plot.style_linebr, linestyle = plot.linestyle_dashed)
plot(session.islastbar or not i_show_prev_daily_low ? na : prev_daily_low, "Prev Daily Low", i_prev_daily_low_color, 2, plot.style_linebr, linestyle = plot.linestyle_dashed)
plot(session.islastbar or not i_show_prev_daily_close ? na : prev_daily_close, "Prev Daily Close", i_prev_daily_close_color, 2, plot.style_linebr, linestyle = plot.linestyle_dashed)
plot(session.islastbar or not i_show_daily_open ? na : daily_open, "Daily Open", i_daily_open_color, 2, plot.style_linebr, linestyle = plot.linestyle_dashed)

Overview

Static Lines plots horizontal lines for the previous daily open, high, low, and close, as well as the current daily open. Traders can customize individual line colors, toggle specific levels on or off, and enable or disable level labels. These reference points help identify key support and resistance zones during intraday sessions. It functions purely as a visual mapping tool without automated trading signals or strategy exits.

Details

Published by

lunarticktrading on GitHub

Code credit

gambcl, as written in the script's header

Type

Indicator, Pine Script v6

Draws

On the price chart

Category

Support & resistance, Sessions & time

Markets

Any symbol

Timeframes

M1-M5, M15-H1

Risk Notes

  • Signals can change on the live bar or after it closes (repainting)

Settings

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

SettingTypeDefaultVariable
Previous Daily Openbooltruei_show_prev_daily_open
i_prev_daily_open_colorcolorcolor.bluei_prev_daily_open_color
Previous Daily Highbooltruei_show_prev_daily_high
i_prev_daily_high_colorcolorcolor.greeni_prev_daily_high_color
Previous Daily Lowbooltruei_show_prev_daily_low
i_prev_daily_low_colorcolorcolor.redi_prev_daily_low_color
Previous Daily Closebooltruei_show_prev_daily_close
i_prev_daily_close_colorcolorcolor.grayi_prev_daily_close_color
Daily Openbooltruei_show_daily_open
i_daily_open_colorcolorcolor.aquai_daily_open_color
Show Labelsbooltruei_show_labels
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