Indicator · Pine Script v5 · On the chart

No Duplicates Interval Range & EQ

by regalouisei· code credited to rumpypumpydumpy

Plots key period levels including Open, High, Low, and Equilibrium (EQ) for multi-timeframe intervals such as yearly and quarterly periods directly on the price chart.

View on GitHub

GitHub stars2on the repository
Pine versionv5runs as is
Lines of code352
Settings40inputs
LicenceNone statedfile: MPL-2.0
Last update8 months ago25 Feb 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

352 lines of Pine Script v5 from pinescript/editors_picks/no-duplicates-interval-range-eq.pine, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.

no-duplicates-interval-range-eq.pine
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © rumpypumpydumpy

//@version=5
indicator("No duplicates interval rangee  & eq", overlay = true, max_lines_count = 56, max_labels_count = 56)


// Create Level Function {
// -----------------------------------------------------------------------------

f_create_level(_type, _start_condition, _active_condition, _global_level_array, _color, _line_width, _line_ext, _line_style, _label_size, _title, _iter, _is_enabled) =>
    // _type [ string ] : Determines level type to manage. Available options : "open", "high", "low", "eq"
    // _start_condition [ bool ] : Determines when to obtain initial value
    // _active_condition [ bool ] : Determines when to continue updated value if applicable
    // _global_level_array [ float[] ] : global array where other of same type of levels are stored to find duplicates
    // _color [ color ] : color of line/text
    // _line_ext [ int ] : Distance to extend line to the right
    // _line_style [ const string ] : line style type
    // _label_size [ const string ] : label size used to set text size
    // _title [ string ] : Prefix for level's text
    // _iter [ int ] : How many previous iterations to retrieve level from
    // _is_enabled : Override for disabling level
    var float _price = na
    var int _start_time = na
    var float _hh = na
    var float _ll = na
    var line _price_line = line.new(x1 = na, y1 = na, x2 = na, y2 = na, xloc = xloc.bar_time, color = _color, width = _line_width, style = _line_style)
    var label _price_label = label.new(x = na, y = na, xloc = xloc.bar_time, style = label.style_label_left, color = #00000000, size = _label_size, textcolor = _color)
    
    _end_time = int(time + _line_ext * ta.change(time))
    
    if _type == "open"
        if _start_condition
            _price := open
            _start_time := time
    else if _type == "high"
        if _start_condition
            _price := high
            _start_time := time
        else if _active_condition
            _price := math.max(_price, high)
    else if _type == "low"
        if _start_condition
            _price := low
            _start_time := time
        else if _active_condition
            _price := math.min(_price, low)
    else if _type == "eq"
        if _start_condition
            _hh := high
            _ll := low
            _price := math.avg(_hh, _ll)
            _start_time := time
        else if _active_condition
            _hh := math.max(_hh, high)
            _ll := math.min(_ll, low)
            _price := math.avg(_hh, _ll)
            
    float _price_val = _iter == 0 ? _price : ta.valuewhen(_start_condition, _price[1], _iter - 1)
    int _start_time_val = _iter == 0 ? _start_time : ta.valuewhen(_start_condition, _start_time[1], _iter - 1)
    
    _found_existing = array.indexof(_global_level_array, _price_val) > -1
    
    if _is_enabled
        if _found_existing
            line.set_xy1(_price_line, x = na, y = na)
            line.set_xy2(_price_line, x = na, y = na)
            label.set_xy(_price_label, x = na, y = na)
        else
            array.push(_global_level_array, _price_val)
            line.set_xy1(_price_line, x = _start_time_val, y = _price_val)
            line.set_xy2(_price_line, x = _end_time, y = _price_val)
            label.set_text(_price_label, text = _title + " : " + str.tostring(_price_val))
            label.set_xy(_price_label, x = _end_time, y = _price_val)
            
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// }



// Necessary Variables {
// -----------------------------------------------------------------------------

// Global arrays used to detect duplicate levels.
// Duplication is detected implicitly by execution order and whether the level has already been placed in the global array.
float[] global_open_array = array.new_float()
float[] global_high_array = array.new_float()
float[] global_low_array = array.new_float()
float[] global_eq_array = array.new_float()

new_H4 = ta.change(time("240")) != 0
new_day = ta.change(time("D")) != 0
new_week = ta.change(time("W")) != 0
new_month = ta.change(time("M")) != 0
new_quarter = ta.change(time("3M")) != 0
new_year = ta.change(time("12M")) != 0
is_monday = dayofweek == dayofweek.monday

// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// }



// Global settings {
// -----------------------------------------------------------------------------

inp_open_line_style =   input.string("Dotted",  options = ["Solid", "Dotted", "Dashed"], title = "Open Line Style", group = "Global Settings")
inp_high_line_style =   input.string("Solid",   options = ["Solid", "Dotted", "Dashed"], title = "High Line Style", group = "Global Settings")
inp_low_line_style =    input.string("Solid",   options = ["Solid", "Dotted", "Dashed"], title = "Low Line Style",  group = "Global Settings")
inp_eq_line_style =     input.string("Dashed",  options = ["Solid", "Dotted", "Dashed"], title = "EQ Line Style",   group = "Global Settings")

inp_text_size =         input.string("Small", options = ["Small", "Normal", "Large"], title = "Text Size", group = "Global Settings")
inp_ext =               input.int(30, title = "Line Extension", group = "Global Settings")

text_size = inp_text_size == "Small" ? size.small : inp_text_size == "Normal" ? size.normal : size.large
open_line_style = inp_open_line_style == "Solid" ? line.style_solid : inp_open_line_style == "Dotted" ? line.style_dotted : line.style_dashed
high_line_style = inp_high_line_style == "Solid" ? line.style_solid : inp_high_line_style == "Dotted" ? line.style_dotted : line.style_dashed
low_line_style = inp_low_line_style == "Solid" ? line.style_solid : inp_low_line_style == "Dotted" ? line.style_dotted : line.style_dashed
eq_line_style = inp_eq_line_style == "Solid" ? line.style_solid : inp_eq_line_style == "Dotted" ? line.style_dotted : line.style_dashed

// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// }



// Yearly & Prev Yearly
// -----------------------------------------------------------------------------
inp_show_yearly_open =  input.bool(true, title = "OPEN", group = "Yearly Levels", inline = "1")
inp_show_yearly_high =  input.bool(true, title = "HIGH", group = "Yearly Levels", inline = "1")
inp_show_yearly_low =   input.bool(true, title = "LOW", group = "Yearly Levels", inline = "1")
inp_show_yearly_eq =    input.bool(true, title = "EQ",  group = "Yearly Levels", inline = "1")
inp_yearly_col =        input.color(color.red, title = "color", group = "Yearly Levels", inline = "2")
inp_yearly_line_width = input.int(5, title = "Line width", minval = 1, group = "Yearly Levels", inline = "2")

yearly_ok = timeframe.isintraday or timeframe.isdaily or timeframe.isweekly or (timeframe.ismonthly and timeframe.multiplier < 12)

f_create_level("open", new_year, not new_year, global_open_array, inp_yearly_col, inp_yearly_line_width, inp_ext, open_line_style, text_size, "Yearly OPEN", 0, inp_show_yearly_open and yearly_ok)
f_create_level("high", new_year, not new_year, global_high_array, inp_yearly_col, inp_yearly_line_width, inp_ext, high_line_style, text_size, "Yearly HIGH", 0, inp_show_yearly_high and yearly_ok)
f_create_level("low", new_year, not new_year, global_low_array, inp_yearly_col, inp_yearly_line_width, inp_ext, low_line_style, text_size, "Yearly LOW", 0, inp_show_yearly_low and yearly_ok)
f_create_level("eq", new_year, not new_year, global_eq_array, inp_yearly_col, inp_yearly_line_width, inp_ext, eq_line_style, text_size, "Yearly EQ", 0, inp_show_yearly_eq and yearly_ok)


inp_show_prev_yearly_open =  input.bool(true, title = "OPEN", group = "Prev Yearly Levels", inline = "1")
inp_show_prev_yearly_high =  input.bool(true, title = "HIGH", group = "Prev Yearly Levels", inline = "1")
inp_show_prev_yearly_low =   input.bool(true, title = "LOW", group = "Prev Yearly Levels", inline = "1")
inp_show_prev_yearly_eq =    input.bool(true, title = "EQ",  group = "Prev Yearly Levels", inline = "1")
inp_prev_yearly_col =        input.color(color.maroon, title = "color", group = "Prev Yearly Levels", inline = "2")
inp_prev_yearly_line_width = input.int(5, title = "Line width", minval = 1, group = "Prev Yearly Levels", inline = "2")

f_create_level("open", new_year, not new_year, global_open_array, inp_prev_yearly_col, inp_prev_yearly_line_width, inp_ext, open_line_style, text_size, "Prev Yearly OPEN", 1, inp_show_prev_yearly_open and yearly_ok)
f_create_level("high", new_year, not new_year, global_high_array, inp_prev_yearly_col, inp_prev_yearly_line_width, inp_ext, high_line_style, text_size, "Prev Yearly HIGH", 1, inp_show_prev_yearly_high and yearly_ok)
f_create_level("low", new_year, not new_year, global_low_array, inp_prev_yearly_col, inp_prev_yearly_line_width, inp_ext, low_line_style, text_size, "Prev Yearly LOW", 1, inp_show_prev_yearly_low and yearly_ok)
f_create_level("eq", new_year, not new_year, global_eq_array, inp_prev_yearly_col, inp_prev_yearly_line_width, inp_ext, eq_line_style, text_size, "Prev Yearly EQ", 1, inp_show_prev_yearly_eq and yearly_ok)
// -----------------------------------------------------------------------------



// Quarterly and Prev Quarterly
// -----------------------------------------------------------------------------
inp_show_quarterly_open =  input.bool(true, title = "OPEN", group = "Quarterly Levels", inline = "1")
inp_show_quarterly_high =  input.bool(true, title = "HIGH", group = "Quarterly Levels", inline = "1")
inp_show_quarterly_low =   input.bool(true, title = "LOW", group = "Quarterly Levels", inline = "1")
inp_show_quarterly_eq =    input.bool(true, title = "EQ",  group = "Quarterly Levels", inline = "1")
inp_quarterly_col =        input.color(color.orange, title = "color", group = "Quarterly Levels", inline = "2")
inp_quarterly_line_width = input.int(4, title = "Line width", minval = 1, group = "Quarterly Levels", inline = "2")

quarterly_ok = timeframe.isintraday or timeframe.isdaily or timeframe.isweekly

f_create_level("open", new_quarter, not new_quarter, global_open_array, inp_quarterly_col, inp_quarterly_line_width, inp_ext, open_line_style, text_size, "Quarterly OPEN", 0, inp_show_quarterly_open and quarterly_ok)
f_create_level("high", new_quarter, not new_quarter, global_high_array, inp_quarterly_col, inp_quarterly_line_width, inp_ext, high_line_style, text_size, "Quarterly HIGH", 0, inp_show_quarterly_high and quarterly_ok)
f_create_level("low", new_quarter, not new_quarter, global_low_array, inp_quarterly_col, inp_quarterly_line_width, inp_ext, low_line_style, text_size, "Quarterly LOW", 0, inp_show_quarterly_low and quarterly_ok)
f_create_level("eq", new_quarter, not new_quarter, global_eq_array, inp_quarterly_col, inp_quarterly_line_width, inp_ext, eq_line_style, text_size, "Quarterly EQ", 0, inp_show_quarterly_eq and quarterly_ok)


inp_show_prev_quarterly_open =  input.bool(true, title = "OPEN", group = "Prev Quarterly Levels", inline = "1")
inp_show_prev_quarterly_high =  input.bool(true, title = "HIGH", group = "Prev Quarterly Levels", inline = "1")
inp_show_prev_quarterly_low =   input.bool(true, title = "LOW", group = "Prev Quarterly Levels", inline = "1")
inp_show_prev_quarterly_eq =    input.bool(true, title = "EQ",  group = "Prev Quarterly Levels", inline = "1")
inp_prev_quarterly_col =        input.color(color.yellow, title = "color", group = "Prev Quarterly Levels", inline = "2")
inp_prev_quarterly_line_width = input.int(4, title = "Line width", minval = 1, group = "Prev Quarterly Levels", inline = "2")

f_create_level("open", new_quarter, not new_quarter, global_open_array, inp_prev_quarterly_col, inp_prev_quarterly_line_width, inp_ext, open_line_style, text_size, "Prev Quarterly OPEN", 1, inp_show_prev_quarterly_open and quarterly_ok)
f_create_level("high", new_quarter, not new_quarter, global_high_array, inp_prev_quarterly_col, inp_prev_quarterly_line_width, inp_ext, high_line_style, text_size, "Prev Quarterly HIGH", 1, inp_show_prev_quarterly_high and quarterly_ok)
f_create_level("low", new_quarter, not new_quarter, global_low_array, inp_prev_quarterly_col, inp_prev_quarterly_line_width, inp_ext, low_line_style, text_size, "Prev Quarterly LOW", 1, inp_show_prev_quarterly_low and quarterly_ok)
f_create_level("eq", new_quarter, not new_quarter, global_eq_array, inp_prev_quarterly_col, inp_prev_quarterly_line_width, inp_ext, eq_line_style, text_size, "Prev Quarterly EQ", 1, inp_show_prev_quarterly_eq and quarterly_ok)
// -----------------------------------------------------------------------------




// Monthly and Prev Monthly
// -----------------------------------------------------------------------------
inp_show_monthly_open =  input.bool(true, title = "OPEN", group = "Monthly Levels", inline = "1")
inp_show_monthly_high =  input.bool(true, title = "HIGH", group = "Monthly Levels", inline = "1")
inp_show_monthly_low =   input.bool(true, title = "LOW", group = "Monthly Levels", inline = "1")
inp_show_monthly_eq =    input.bool(true, title = "EQ",  group = "Monthly Levels", inline = "1")
inp_monthly_col =        input.color(color.lime, title = "color", group = "Monthly Levels", inline = "2")
inp_monthly_line_width = input.int(3, title = "Line width", minval = 1, group = "Monthly Levels", inline = "2")

monthly_ok = timeframe.isintraday or timeframe.isdaily

f_create_level("open", new_month, not new_month, global_open_array, inp_monthly_col, inp_monthly_line_width, inp_ext, open_line_style, text_size, "Monthly OPEN", 0, inp_show_monthly_open and monthly_ok)
f_create_level("high", new_month, not new_month, global_high_array, inp_monthly_col, inp_monthly_line_width, inp_ext, high_line_style, text_size, "Monthly HIGH", 0, inp_show_monthly_high and monthly_ok)
f_create_level("low", new_month, not new_month, global_low_array, inp_monthly_col, inp_monthly_line_width, inp_ext, low_line_style, text_size, "Monthly LOW", 0, inp_show_monthly_low and monthly_ok)
f_create_level("eq", new_month, not new_month, global_eq_array, inp_monthly_col, inp_monthly_line_width, inp_ext, eq_line_style, text_size, "Monthly EQ", 0, inp_show_monthly_eq and monthly_ok)


inp_show_prev_monthly_open =  input.bool(true, title = "OPEN", group = "Prev Monthly Levels", inline = "1")
inp_show_prev_monthly_high =  input.bool(true, title = "HIGH", group = "Prev Monthly Levels", inline = "1")
inp_show_prev_monthly_low =   input.bool(true, title = "LOW", group = "Prev Monthly Levels", inline = "1")
inp_show_prev_monthly_eq =    input.bool(true, title = "EQ",  group = "Prev Monthly Levels", inline = "1")
inp_prev_monthly_col =        input.color(color.green, title = "color", group = "Prev Monthly Levels", inline = "2")
inp_prev_monthly_line_width = input.int(3, title = "Line width", minval = 1, group = "Prev Monthly Levels", inline = "2")

f_create_level("open", new_month, not new_month, global_open_array, inp_prev_monthly_col, inp_prev_monthly_line_width, inp_ext, open_line_style, text_size, "Prev Monthly OPEN", 1, inp_show_prev_monthly_open and monthly_ok)
f_create_level("high", new_month, not new_month, global_high_array, inp_prev_monthly_col, inp_prev_monthly_line_width, inp_ext, high_line_style, text_size, "Prev Monthly HIGH", 1, inp_show_prev_monthly_high and monthly_ok)
f_create_level("low", new_month, not new_month, global_low_array, inp_prev_monthly_col, inp_prev_monthly_line_width, inp_ext, low_line_style, text_size, "Prev Monthly LOW", 1, inp_show_prev_monthly_low and monthly_ok)
f_create_level("eq", new_month, not new_month, global_eq_array, inp_prev_monthly_col, inp_prev_monthly_line_width, inp_ext, eq_line_style, text_size, "Prev Monthly EQ", 1, inp_show_prev_monthly_eq and monthly_ok)
// -----------------------------------------------------------------------------



// Weekly and Prev Weekly
// -----------------------------------------------------------------------------
inp_show_weekly_open =  input.bool(true, title = "OPEN", group = "Weekly Levels", inline = "1")
inp_show_weekly_high =  input.bool(true, title = "HIGH", group = "Weekly Levels", inline = "1")
inp_show_weekly_low =   input.bool(true, title = "LOW", group = "Weekly Levels", inline = "1")
inp_show_weekly_eq =    input.bool(true, title = "EQ",  group = "Weekly Levels", inline = "1")
inp_weekly_col =        input.color(color.aqua, title = "color", group = "Weekly Levels", inline = "2")
inp_weekly_line_width = input.int(2, title = "Line width", minval = 1, group = "Weekly Levels", inline = "2")

weekly_ok = timeframe.isintraday or timeframe.isdaily

f_create_level("open", new_week, not new_week, global_open_array, inp_weekly_col, inp_weekly_line_width, inp_ext, open_line_style, text_size, "Weekly OPEN", 0, inp_show_weekly_open and weekly_ok)
f_create_level("high", new_week, not new_week, global_high_array, inp_weekly_col, inp_weekly_line_width, inp_ext, high_line_style, text_size, "Weekly HIGH", 0, inp_show_weekly_high and weekly_ok)
f_create_level("low", new_week, not new_week, global_low_array, inp_weekly_col, inp_weekly_line_width, inp_ext, low_line_style, text_size, "Weekly LOW", 0, inp_show_weekly_low and weekly_ok)
f_create_level("eq", new_week, not new_week, global_eq_array, inp_weekly_col, inp_weekly_line_width, inp_ext, eq_line_style, text_size, "Weekly EQ", 0, inp_show_weekly_eq and weekly_ok)


inp_show_prev_weekly_open =  input.bool(true, title = "OPEN", group = "Prev Weekly Levels", inline = "1")
inp_show_prev_weekly_high =  input.bool(true, title = "HIGH", group = "Prev Weekly Levels", inline = "1")
inp_show_prev_weekly_low =   input.bool(true, title = "LOW", group = "Prev Weekly Levels", inline = "1")
inp_show_prev_weekly_eq =    input.bool(true, title = "EQ",  group = "Prev Weekly Levels", inline = "1")
inp_prev_weekly_col =        input.color(color.blue, title = "color", group = "Prev Weekly Levels", inline = "2")
inp_prev_weekly_line_width = input.int(2, title = "Line width", minval = 1, group = "Prev Weekly Levels", inline = "2")

f_create_level("open", new_week, not new_week, global_open_array, inp_prev_weekly_col, inp_prev_weekly_line_width, inp_ext, open_line_style, text_size, "Prev Weekly OPEN", 1, inp_show_prev_weekly_open and weekly_ok)
f_create_level("high", new_week, not new_week, global_high_array, inp_prev_weekly_col, inp_prev_weekly_line_width, inp_ext, high_line_style, text_size, "Prev Weekly HIGH", 1, inp_show_prev_weekly_high and weekly_ok)
f_create_level("low", new_week, not new_week, global_low_array, inp_prev_weekly_col, inp_prev_weekly_line_width, inp_ext, low_line_style, text_size, "Prev Weekly LOW", 1, inp_show_prev_weekly_low and weekly_ok)
f_create_level("eq", new_week, not new_week, global_eq_array, inp_prev_weekly_col, inp_prev_weekly_line_width, inp_ext, eq_line_style, text_size, "Prev Weekly EQ", 1, inp_show_prev_weekly_eq and weekly_ok)
// -----------------------------------------------------------------------------




// Daily and Prev Daily
// -----------------------------------------------------------------------------
inp_show_daily_open =  input.bool(true, title = "OPEN", group = "Daily Levels", inline = "1")
inp_show_daily_high =  input.bool(true, title = "HIGH", group = "Daily Levels", inline = "1")
inp_show_daily_low =   input.bool(true, title = "LOW", group = "Daily Levels", inline = "1")
inp_show_daily_eq =    input.bool(true, title = "EQ",  group = "Daily Levels", inline = "1")
inp_daily_col =        input.color(color.white, title = "color", group = "Daily Levels", inline = "2")
inp_daily_line_width = input.int(1, title = "Line width", minval = 1, group = "Daily Levels", inline = "2")

daily_ok = timeframe.isintraday

f_create_level("open", new_day, not new_day, global_open_array, inp_daily_col, inp_daily_line_width, inp_ext, open_line_style, text_size, "Daily OPEN", 0, inp_show_daily_open and daily_ok)
f_create_level("high", new_day, not new_day, global_high_array, inp_daily_col, inp_daily_line_width, inp_ext, high_line_style, text_size, "Daily HIGH", 0, inp_show_daily_high and daily_ok)
f_create_level("low", new_day, not new_day, global_low_array, inp_daily_col, inp_daily_line_width, inp_ext, low_line_style, text_size, "Daily LOW", 0, inp_show_daily_low and daily_ok)
f_create_level("eq", new_day, not new_day, global_eq_array, inp_daily_col, inp_daily_line_width, inp_ext, eq_line_style, text_size, "Daily EQ", 0, inp_show_daily_eq and daily_ok)


inp_show_prev_daily_open =  input.bool(true, title = "OPEN", group = "Prev Daily Levels", inline = "1")
inp_show_prev_daily_high =  input.bool(true, title = "HIGH", group = "Prev Daily Levels", inline = "1")
inp_show_prev_daily_low =   input.bool(true, title = "LOW", group = "Prev Daily Levels", inline = "1")
inp_show_prev_daily_eq =    input.bool(true, title = "EQ",  group = "Prev Daily Levels", inline = "1")
inp_prev_daily_col =        input.color(color.gray, title = "color", group = "Prev Daily Levels", inline = "2")
inp_prev_daily_line_width = input.int(1, title = "Line width", minval = 1, group = "Prev Daily Levels", inline = "2")

f_create_level("open", new_day, not new_day, global_open_array, inp_prev_daily_col, inp_prev_daily_line_width, inp_ext, open_line_style, text_size, "Prev Daily OPEN", 1, inp_show_prev_daily_open and daily_ok)
f_create_level("high", new_day, not new_day, global_high_array, inp_prev_daily_col, inp_prev_daily_line_width, inp_ext, high_line_style, text_size, "Prev Daily HIGH", 1, inp_show_prev_daily_high and daily_ok)
f_create_level("low", new_day, not new_day, global_low_array, inp_prev_daily_col, inp_prev_daily_line_width, inp_ext, low_line_style, text_size, "Prev Daily LOW", 1, inp_show_prev_daily_low and daily_ok)
f_create_level("eq", new_day, not new_day, global_eq_array, inp_prev_daily_col, inp_prev_daily_line_width, inp_ext, eq_line_style, text_size, "Prev Daily EQ", 1, inp_show_prev_daily_eq and daily_ok)
// -----------------------------------------------------------------------------



// Monday and Prev Monday
// -----------------------------------------------------------------------------
// Note : Monday range is a special case and is why the _active_condition is implemented in the function. We only want start on Monday, and ONLY update levels during monday.
inp_show_monday_open =  input.bool(true, title = "OPEN", group = "Monday Levels", inline = "1")
inp_show_monday_high =  input.bool(true, title = "HIGH", group = "Monday Levels", inline = "1")
inp_show_monday_low =   input.bool(true, title = "LOW", group = "Monday Levels", inline = "1")
inp_show_monday_eq =    input.bool(true, title = "EQ",  group = "Monday Levels", inline = "1")
inp_monday_col =        input.color(color.fuchsia, title = "color", group = "Monday Levels", inline = "2")
inp_monday_line_width = input.int(1, title = "Line width", minval = 1, group = "Monday Levels", inline = "2")

monday_ok = timeframe.isintraday

f_create_level("open", new_week, is_monday, global_open_array, inp_monday_col, inp_monday_line_width, inp_ext, open_line_style, text_size, "Monday OPEN", 0, inp_show_monday_open and monday_ok)
f_create_level("high", new_week, is_monday, global_high_array, inp_monday_col, inp_monday_line_width, inp_ext, high_line_style, text_size, "Monday HIGH", 0, inp_show_monday_high and monday_ok)
f_create_level("low", new_week, is_monday, global_low_array, inp_monday_col, inp_monday_line_width, inp_ext, low_line_style, text_size, "Monday LOW", 0, inp_show_monday_low and monday_ok)
f_create_level("eq", new_week, is_monday, global_eq_array, inp_monday_col, inp_monday_line_width, inp_ext, eq_line_style, text_size, "Monday EQ", 0, inp_show_monday_eq and monday_ok)


inp_show_prev_monday_open =  input.bool(true, title = "OPEN", group = "Prev Monday Levels", inline = "1")
inp_show_prev_monday_high =  input.bool(true, title = "HIGH", group = "Prev Monday Levels", inline = "1")
inp_show_prev_monday_low =   input.bool(true, title = "LOW", group = "Prev Monday Levels", inline = "1")
inp_show_prev_monday_eq =    input.bool(true, title = "EQ",  group = "Prev Monday Levels", inline = "1")
inp_prev_monday_col =        input.color(color.purple, title = "color", group = "Prev Monday Levels", inline = "2")
inp_prev_monday_line_width = input.int(1, title = "Line width", minval = 1, group = "Prev Monday Levels", inline = "2")

f_create_level("open", new_week, is_monday, global_open_array, inp_prev_monday_col, inp_prev_monday_line_width, inp_ext, open_line_style, text_size, "Prev Monday OPEN", 1, inp_show_prev_monday_open and monday_ok)
f_create_level("high", new_week, is_monday, global_high_array, inp_prev_monday_col, inp_prev_monday_line_width, inp_ext, high_line_style, text_size, "Prev Monday HIGH", 1, inp_show_prev_monday_high and monday_ok)
f_create_level("low", new_week, is_monday, global_low_array, inp_prev_monday_col, inp_prev_monday_line_width, inp_ext, low_line_style, text_size, "Prev Monday LOW", 1, inp_show_prev_monday_low and monday_ok)
f_create_level("eq", new_week, is_monday, global_eq_array, inp_prev_monday_col, inp_prev_monday_line_width, inp_ext, eq_line_style, text_size, "Prev Monday EQ", 1, inp_show_prev_monday_eq and monday_ok)
// -----------------------------------------------------------------------------



// H4 and Prev H4
// -----------------------------------------------------------------------------
inp_show_H4_open =  input.bool(true, title = "OPEN", group = "H4 Levels", inline = "1")
inp_show_H4_high =  input.bool(true, title = "HIGH", group = "H4 Levels", inline = "1")
inp_show_H4_low =   input.bool(true, title = "LOW", group = "H4 Levels", inline = "1")
inp_show_H4_eq =    input.bool(true, title = "EQ",  group = "H4 Levels", inline = "1")
inp_H4_col =        input.color(color.teal, title = "color", group = "H4 Levels", inline = "2")
inp_H4_line_width = input.int(1, title = "Line width", minval = 1, group = "H4 Levels", inline = "2")

H4_ok = timeframe.isintraday and timeframe.multiplier < 240

f_create_level("open", new_H4, not new_H4, global_open_array, inp_H4_col, inp_H4_line_width, inp_ext, open_line_style, text_size, "H4 OPEN", 0, inp_show_H4_open and H4_ok)
f_create_level("high", new_H4, not new_H4, global_high_array, inp_H4_col, inp_H4_line_width, inp_ext, high_line_style, text_size, "H4 HIGH", 0, inp_show_H4_high and H4_ok)
f_create_level("low", new_H4, not new_H4, global_low_array, inp_H4_col, inp_H4_line_width, inp_ext, low_line_style, text_size, "H4 LOW", 0, inp_show_H4_low and H4_ok)
f_create_level("eq", new_H4, not new_H4, global_eq_array, inp_H4_col, inp_H4_line_width, inp_ext, eq_line_style, text_size, "H4 EQ", 0, inp_show_H4_eq and H4_ok)


inp_show_prev_H4_open =  input.bool(true, title = "OPEN", group = "Prev H4 Levels", inline = "1")
inp_show_prev_H4_high =  input.bool(true, title = "HIGH", group = "Prev H4 Levels", inline = "1")
inp_show_prev_H4_low =   input.bool(true, title = "LOW", group = "Prev H4 Levels", inline = "1")
inp_show_prev_H4_eq =    input.bool(true, title = "EQ",  group = "Prev H4 Levels", inline = "1")
inp_prev_H4_col =        input.color(color.olive, title = "color", group = "Prev H4 Levels", inline = "2")
inp_prev_H4_line_width = input.int(1, title = "Line width", minval = 1, group = "Prev H4 Levels", inline = "2")

f_create_level("open", new_H4, not new_H4, global_open_array, inp_prev_H4_col, inp_prev_H4_line_width, inp_ext, open_line_style, text_size, "Prev H4 OPEN", 1, inp_show_prev_H4_open and H4_ok)
f_create_level("high", new_H4, not new_H4, global_high_array, inp_prev_H4_col, inp_prev_H4_line_width, inp_ext, high_line_style, text_size, "Prev H4 HIGH", 1, inp_show_prev_H4_high and H4_ok)
f_create_level("low", new_H4, not new_H4, global_low_array, inp_prev_H4_col, inp_prev_H4_line_width, inp_ext, low_line_style, text_size, "Prev H4 LOW", 1, inp_show_prev_H4_low and H4_ok)
f_create_level("eq", new_H4, not new_H4, global_eq_array, inp_prev_H4_col, inp_prev_H4_line_width, inp_ext, eq_line_style, text_size, "Prev H4 EQ", 1, inp_show_prev_H4_eq and H4_ok)
// -----------------------------------------------------------------------------

Overview

To prevent chart clutter, the script checks across active levels and suppresses duplicates. Users can toggle individual period levels, customize line styles, colors, line widths, text sizing, and set the rightward extension length for projected level lines.

Details

Published by

regalouisei on GitHub

Code credit

rumpypumpydumpy, as written in the script's header

Type

Indicator, Pine Script v5

Draws

On the price chart

Category

Support & resistance

Markets

Any symbol

Timeframes

Any timeframe

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
Open Line StylestringDottedinp_open_line_style
High Line StylestringSolidinp_high_line_style
Low Line StylestringSolidinp_low_line_style
EQ Line StylestringDashedinp_eq_line_style
Text SizestringSmallinp_text_size
Line Extensionint30inp_ext
OPENbooltrueinp_show_yearly_open
HIGHbooltrueinp_show_yearly_high
LOWbooltrueinp_show_yearly_low
EQbooltrueinp_show_yearly_eq
colorcolorcolor.redinp_yearly_col
Line widthint5inp_yearly_line_width
Show all 40 settings
SettingTypeDefaultVariable
OPENbooltrueinp_show_prev_yearly_open
HIGHbooltrueinp_show_prev_yearly_high
LOWbooltrueinp_show_prev_yearly_low
EQbooltrueinp_show_prev_yearly_eq
colorcolorcolor.marooninp_prev_yearly_col
Line widthint5inp_prev_yearly_line_width
OPENbooltrueinp_show_quarterly_open
HIGHbooltrueinp_show_quarterly_high
LOWbooltrueinp_show_quarterly_low
EQbooltrueinp_show_quarterly_eq
colorcolorcolor.orangeinp_quarterly_col
Line widthint4inp_quarterly_line_width
OPENbooltrueinp_show_prev_quarterly_open
HIGHbooltrueinp_show_prev_quarterly_high
LOWbooltrueinp_show_prev_quarterly_low
EQbooltrueinp_show_prev_quarterly_eq
colorcolorcolor.yellowinp_prev_quarterly_col
Line widthint4inp_prev_quarterly_line_width
OPENbooltrueinp_show_monthly_open
HIGHbooltrueinp_show_monthly_high
LOWbooltrueinp_show_monthly_low
EQbooltrueinp_show_monthly_eq
colorcolorcolor.limeinp_monthly_col
Line widthint3inp_monthly_line_width
OPENbooltrueinp_show_prev_monthly_open
HIGHbooltrueinp_show_prev_monthly_high
LOWbooltrueinp_show_prev_monthly_low
EQbooltrueinp_show_prev_monthly_eq
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

948 stars

Moving Average Channel plots separate simple moving averages for upper and lower bands on the price chart. It fills the space between bands with semi-transparent color and colors bars green above the upper band, red below the lower band, or gray in between. Us

Indicator v4 Moving averagesSupport & resistance
Updated 10 days ago · GPL-3.0 GitHub repository of Moving Average Channel

ICT Equal Highs and Lows

by ArunKBhaskar
575 stars

This overlay indicator finds pivot highs and lows on the price chart and compares the last two highs and the last two lows. When the percentage difference between a pair is below the Equal HL threshold, it treats them as equal levels and draws a box. Left and

Indicator v5 SMC / ICT / price actionSupport & resistance
Updated 1 year ago · MPL-2.0 GitHub repository of ICT Equal Highs and Lows
330 stars

This indicator monitors multiple cryptocurrency symbols for trading signals. It calculates and plots entry prices, take profit, and stop loss levels for each symbol including BTCUSDT, ETHUSDT, BNBUSDT and others. Price crossovers trigger buy, sell or close ale

Indicator v5 Support & resistanceScreeners & dashboards
Updated 2 months ago · None stated GitHub repository of Multi Alert Long/Short [Alorse]

This overlay indicator draws a fixed-range volume profile on the price chart, splitting traded activity into up and down volume at each price level. It also plots a sentiment profile, a developing point of control, and value-area high and low around a configur

Indicator v5 VolumeSupport & resistance
Updated 2 months ago · MIT GitHub repository of Volume Profile and Indicator by DGT

BZ-tracker

by Allen1212
303 stars

The BZ-tracker indicator marks ARK Invest buy and sell transactions on stock charts with labels. It plots green labels for purchases and red labels for sales, each annotated with a multiplier such as X1 or X2 to show the number of ARK ETFs trading the stock on

Indicator v4 Support & resistanceScreeners & dashboards
Updated 2 years ago · None stated GitHub repository of BZ-tracker

Function - Linear Regression

by ricardosantos79
261 stars

This indicator fits a linear regression through stored pivot highs and lows and draws the resulting channel on the price chart. A function returns predicted values, maximum and minimum deviations, and the average absolute deviation. Confirmed two-bar pivots up

Indicator v5 TrendSupport & resistance
Updated 4 years ago · None stated GitHub repository of Function - Linear Regression

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