Indicator · Pine Script v6 · On the chart

DrawLevels

by ashwagamma

This indicator draws predefined support and resistance levels, price range boxes, and key value area markers directly on the price chart.

View on GitHub

GitHub stars2on the repository
Pine versionv6current
Lines of code120
Settings3inputs
LicenceNone statedfile: MPL-2.0
Last update1 year ago23 Jun 2025

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

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

DrawLevels_v2.txt
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © ashwagamma

//@version=6
indicator("DrawLevels_v2", overlay=true, max_lines_count = 500, max_boxes_count=500, max_labels_count=500)

int[] levels_support = array.from(5756,5747,5726,5720,5712,5706,5699,5686,5678,5668,5660,5644,5636,5610,5601,5588,5580,5558,5546,5537,5525,5514,5507,5500,5492,5482,5457,5446,5438,5427)
int[] ranges_support_0 = array.from(5738,5650,5620,5560,5469)
int[] ranges_support_1 = array.from(5740,5654,5625,5564,5471)
int[] levels_resistance = array.from(5763,5772,5783,5797,5803,5809,5816,5824,5836,5842,5850,5860,5865,5872,5886,5893,5901,5910,5918,5945,5954,5958,5962,5985,5990,6010,6014,6020,6031,6039,6048,6056,6077,6083,6101,6109,6120)
int[] ranges_resistance_0 = array.from(5927,5970,5995,6068,6090)
int[] ranges_resistance_1 = array.from(5932,5975,6000,6072,6093)
string[] labels_support = array.from("5756 (Major; lof38to40&r)","5747 ","5726 ","5720 (major; dilo_iffnomelt; lof&r; lopop38to40+; shobkdn)","5712 ","5706 ","5699 (major)","5686 (major; possdilo)","5678 ","5668 ","5660 ","5644 ","5636 ","5610 ","5601 (major)","5588 ","5580 ","5558 ","5546 ","5537 ","5525 ","5514 (major)","5507 (major)","5500 ","5492 ","5482 (major)","5457 ","5446 (major)","5438 ","5427 (major)")
string[] labels_resistance = array.from("5763 ","5772 ","5783 ","5797 (major; disho_backtest_ovrshoot; lotrappyreclaim)","5803 ","5809 ","5816 (major; disho)","5824 ","5836 (major)","5842 ","5850 (major; disho)","5860 ","5865 (major)","5872 ","5886 (major)","5893 ","5901 ","5910 (major)","5918 ","5945 ","5954 ","5958 ","5962 ","5985 ","5990 ","6010 ","6014 ","6020 (major)","6031 ","6039 (major)","6048 ","6056 ","6077 ","6083 ","6101 (major)","6109 ","6120 (major)")
string[] labels_ranges_support = array.from("5738-40 (major)","5650-54 (major; lofbd)","5620-25 (major; lookforlongs)","5564-60 (major)","5469-71 (major)")
string[] labels_ranges_resistance = array.from("5927-32 (major)","5970-75 (major)","5995-6000 (major)","6068-72 (major)","6090-93 (major)")
int[] levels_va = array.from(5829,5814,5826,5724,5715,5664,6192,5987,6020,5982,5955)
string[] labels_va = array.from("pdVAH","pdVAL","pdPOC","pwVAH","pwVAL","pwPOC","febVAH","febVAL","febPOC","janVAL","decVAL")

int transpBox = 70
colorRes     = input.color(color.red, title = "Resistance Color", group = "Style Settings")
colorSup     = input.color(color.green,   title = "Support Color", group = "Style Settings")
colorVA      = input.color(color.rgb(0,255,255),   title = "VA Color", group = "Style Settings")
var line[] arrSupLine = array.new_line(levels_support.size(), na)
var line[] arrSupRangeLine = array.new_line(ranges_support_0.size(), na)
var line[] arrResLine = array.new_line(levels_resistance.size(), na)
var line[] arrResRangeLine = array.new_line(ranges_resistance_0.size(), na)
var box[] arrSupBox = array.new_box(ranges_support_0.size(), na)
var box[] arrResBox = array.new_box(ranges_resistance_0.size(), na)
var label[] arrSupLineLabel = array.new_label(labels_support.size(), na)
var label[] arrSupRangeLineLabel = array.new_label(ranges_support_0.size(), na)
var label[] arrResLineLabel = array.new_label(labels_resistance.size(), na)
var label[] arrResRangeLineLabel = array.new_label(labels_resistance.size(), na)

var label[] arrVALabel = array.new_label(labels_va.size(), na)
var int[] arrPriorTradingDayTS = array.new_int(2, 0)

if na(array.get(arrSupLine,0))
    for i = 0 to levels_support.size()-1
        array.set(arrSupLine, i, line.new(time, levels_support.get(i), time+1, levels_support.get(i), xloc=xloc.bar_time, color=colorSup))
        array.set(arrSupLineLabel, i, label.new(time, levels_support.get(i), labels_support.get(i), xloc=xloc.bar_time, color=color.new(na,100), textcolor = colorSup, style=label.style_label_left, textalign = text.align_center))

    for i = 0 to levels_resistance.size()-1
        array.set(arrResLine, i, line.new(time, levels_resistance.get(i), time+1, levels_resistance.get(i), xloc=xloc.bar_time, color=colorRes))
        array.set(arrResLineLabel, i, label.new(time, levels_resistance.get(i), labels_resistance.get(i), xloc=xloc.bar_time, color=color.new(na,100), textcolor = colorRes, style=label.style_label_left, textalign = text.align_center))

    for i = 0 to ranges_support_0.size()-1
        array.set(arrSupBox, i, box.new(time, ranges_support_0.get(i), time+1, ranges_support_1.get(i), xloc=xloc.bar_time, bgcolor = color.new(colorSup, transpBox), border_color = na))
        array.set(arrSupRangeLine, i, line.new(time, ranges_support_0.get(i), time+1, ranges_support_0.get(i), xloc=xloc.bar_time, color=colorSup))
        array.set(arrSupRangeLineLabel, i, label.new(time, ranges_support_0.get(i), labels_ranges_support.get(i), xloc=xloc.bar_time, color=color.new(na,100), textcolor = colorSup, style=label.style_label_left, textalign = text.align_center))

    for i = 0 to ranges_resistance_0.size()-1
        array.set(arrResBox, i, box.new(time, ranges_resistance_0.get(i), time+1, ranges_resistance_1.get(i), xloc=xloc.bar_time, bgcolor = color.new(colorRes, transpBox), border_color = na))
        array.set(arrResRangeLine, i, line.new(time, ranges_resistance_0.get(i), time+1, ranges_resistance_0.get(i), xloc=xloc.bar_time, color=colorRes))
        array.set(arrResRangeLineLabel, i, label.new(time, ranges_resistance_0.get(i), labels_ranges_resistance.get(i), xloc=xloc.bar_time, color=color.new(na,100), textcolor = colorRes, style=label.style_label_left, textalign = text.align_center))

    for i = 0 to levels_va.size()-1
        array.set(arrVALabel, i, label.new(time, levels_va.get(i), str.tostring(levels_va.get(i))+' ('+labels_va.get(i)+')', xloc=xloc.bar_time, color=color.new(na,100), textcolor = colorVA, style=label.style_label_right, textalign = text.align_center))

int tct = ta.change(time)
var int startTimePrevTradingDay = na
var int startTime1D = na
var int startTime = na
var int endTime = na

if timeframe.change("1D") and (timenow-time < 7*24*60*60*1000)
    startTime1D := time
    startTime := time - timeframe.in_seconds("1D") * 10000
    endTime := time + timeframe.in_seconds("1D") * 1000
    startTimePrevTradingDay := time - tct
    array.push(arrPriorTradingDayTS, startTimePrevTradingDay)
    if arrPriorTradingDayTS.size() > 2
        array.remove(arrPriorTradingDayTS, 0)
    for i = 0 to arrSupLine.size()-1
        array.get(arrSupLine, i).set_x1(startTime)
    for i = 0 to arrResLine.size()-1
        array.get(arrResLine, i).set_x1(startTime)

    for i = 0 to arrSupRangeLine.size()-1
        array.get(arrSupRangeLine, i).set_x1(startTime)
    for i = 0 to arrResRangeLine.size()-1
        array.get(arrResRangeLine, i).set_x1(startTime)

    for i = 0 to arrSupBox.size()-1
        array.get(arrSupBox, i).set_left(startTime)
    for i = 0 to arrResBox.size()-1
        array.get(arrResBox, i).set_left(startTime)
        
if barstate.islastconfirmedhistory or (barstate.islast and barstate.isconfirmed)
    for i = 0 to arrSupLine.size()-1
        array.get(arrSupLine, i).set_x2((9*last_bar_time+endTime)/10)
        array.get(arrSupLineLabel, i).set_x((9*last_bar_time+endTime)/10)
    for i = 0 to arrResLine.size()-1
        array.get(arrResLine, i).set_x2((9*last_bar_time+endTime)/10)
        array.get(arrResLineLabel, i).set_x((9*last_bar_time+endTime)/10)

    for i = 0 to arrSupRangeLine.size()-1
        array.get(arrSupRangeLine, i).set_x2((9*last_bar_time+endTime)/10)
        array.get(arrSupRangeLineLabel, i).set_x((9*last_bar_time+endTime)/10)
    for i = 0 to arrResRangeLine.size()-1
        array.get(arrResRangeLine, i).set_x2((9*last_bar_time+endTime)/10)
        array.get(arrResRangeLineLabel, i).set_x((9*last_bar_time+endTime)/10)

    for i = 0 to arrSupBox.size()-1
        array.get(arrSupBox, i).set_right((9*last_bar_time+endTime)/10)
    for i = 0 to arrResBox.size()-1
        array.get(arrResBox, i).set_right((9*last_bar_time+endTime)/10)

    for i = 0 to arrVALabel.size()-1
        array.get(arrVALabel, i).set_x(arrPriorTradingDayTS.get(arrPriorTradingDayTS.size()-2))


for i = 0 to levels_support.size()-1
    if (open > levels_support.get(i) and close < levels_support.get(i))
        alert(labels_support.get(i), alert.freq_once_per_bar)

//var bool isDone = false
//if not isDone
//    alert(labels_support.get(0), alert.freq_once_per_bar)
//    isDone := true

Overview

DrawLevels visualizes hardcoded horizontal price levels, support and resistance zones, and value area references such as prior day, weekly, and monthly high, low, and point of control markers. The script provides no trading signals. Main user settings allow customizing the display colors for resistance, support, and value area lines. A key limitation is that all price levels are hardcoded rather than dynamically calculated, making them specific to a fixed price range.

Details

Published by

ashwagamma on GitHub

Type

Indicator, Pine Script v6

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
Resistance Colorcolorcolor.redcolorRes
Support Colorcolorcolor.greencolorSup
VA Colorcolorcolor.rgb(0,255,255)colorVA
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