Indicator · Pine Script v5 · On the chart

CSW Institutional Levels

by g-moe· code credited to goodgains

This indicator plots horizontal lines representing previous highs, lows, and closes from daily, weekly, monthly, quarterly, and yearly periods on the price chart.

View on GitHub

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

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

csw-institutional-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("CSW Institutional Levels", overlay = true)

// @keywords: csw-institutional-levels, institutional-levels, prior-period-high, prior-period-low, prior-period-close, daily-levels, weekly-levels, monthly-levels, quarterly-levels, yearly-levels, support-resistance, confluence-levels, multi-timeframe-levels, horizontal-lines, price-labels, color-legend-table, show-instructions, labeled-levels, dotted-lines, request-security

//--INSTRUCTIONS--//
instructions_tooltip = "• The CSW Institutional Levels Indicator plots previous time periods Highs, Lows, and Closes.
 \nInstitutions track these levels and will use them as support and resistance to enter and exit their positions. 
 \nNot every algorithm is a machine-learning wizard. Institutions still use these relatively simple levels to conduct their trades. 
 \nThe best way to use The CSW Institutional Levels Indicator is to find overlapping levels. 
 \nThese areas or lines are called confluence levels and will act as a stronger level than a single line.
 \n\nFor the labeling.
 \n1. Y stands for Yesterday
 \n2. L stands for Last.
 \n3. H stands for High
 \n4. Low stands for Low
 \n5. C stand for Close
 \nFor example, LMC would equal Last Months Close. LQH, would equal Last Quarters High. YL would equal Yesterdays Low."

instructions = input.bool(title='Show Instructions', defval=false, inline='1', tooltip = instructions_tooltip)
if barstate.islast and instructions
    var label instruction_label = na
    if not na(instruction_label[1])
        label.delete(instruction_label[1])
    instruction_label := label.new(bar_index + 5, close, instructions_tooltip, xloc = xloc.bar_index , yloc = yloc.price, color = color.black , style = label.style_label_left, textcolor = color.white, size = size.large, textalign = text.align_left) 
//--INSTRUCTIONS--//

daily_levels = input.bool(true, title = "Daily Levels", group = "Daily Levels")
daily_line_color = input.color(color.new(color.silver, 20), title = "Line Color", group = "Daily Levels", inline = '2')
daily_text_color = input.color(color.new(color.white, 20), title = "Label Text Color", group = "Daily Levels", inline = '2')


weekly_levels = input.bool(true, title = "Weekly Levels", group = "Weekly Levels")
weekly_line_color = input.color(color.new(color.yellow, 20), title = "Line Color", group = "Weekly Levels", inline = '2')
weekly_text_color = input.color(color.new(color.yellow, 20), title = "Label Text Color", group = "Weekly Levels", inline = '2')


monthly_levels = input.bool(true, title = "Monthly Levels", group = "Monthly Levels")
monthly_line_color = input.color(color.new(color.blue, 20), title = "Line Color", group = "Monthly Levels", inline = '2')
monthly_text_color = input.color(color.new(color.blue, 20), title = "Label Text Color", group = "Monthly Levels", inline = '2')


qtr_levels = input.bool(true, title = "Quarterly Levels", group = "Quarterly Levels")
qtr_line_color = input.color(color.new(color.red, 20), title = "Line Color", group = "Quarterly Levels", inline = '2')
qtr_text_color = input.color(color.new(color.red, 20), title = "Label Text Color", group = "Quarterly Levels", inline = '2')


yearly_levels = input.bool(true, title = "Yearly Levels", group = "Yearly Levels")
yearly_line_color = input.color(color.new(color.orange, 20), title = "Line Color", group = "Yearly Levels", inline = '2')
yearly_text_color = input.color(color.new(color.orange, 20), title = "Label Text Color", group = "Yearly Levels", inline = '2')


timeChange(period) =>
    ta.change(time(period))

institution_function(time_period, line_color, text_color, text_text) =>

    is_new_period = timeChange(time_period)
    
    var first_bar_in_period = 0
    first_bar_in_period := is_new_period ? time : first_bar_in_period[1]
    
    highs = request.security(syminfo.tickerid,time_period, high[1], lookahead=barmerge.lookahead_on)
    lows = request.security(syminfo.tickerid,time_period, low[1], lookahead=barmerge.lookahead_on)
    closes = request.security(syminfo.tickerid,time_period, close[1], lookahead=barmerge.lookahead_on)
    
    high_line = line.new(first_bar_in_period, highs, time, y2 = highs, xloc = xloc.bar_time, extend = extend.right, color = line_color, style = line.style_dotted, width = 2)
    line.delete(high_line[1])
    
    low_line = line.new(first_bar_in_period, lows, time, y2 = lows, xloc = xloc.bar_time, extend = extend.right, color = line_color, style = line.style_dotted, width = 2)
    line.delete(low_line[1])
    
    close_line = line.new(first_bar_in_period, closes, time, y2 = closes, xloc = xloc.bar_time, extend = extend.right, color = line_color, style = line.style_dotted, width = 2)
    line.delete(close_line[1])
    
    high_label = label.new(x = bar_index + 70, y = highs, text = text_text + "H", style = label.style_none, textcolor = text_color)
    label.delete(high_label[1])
    
    low_label = label.new(x = bar_index + 70, y = lows, text = text_text + "L", style = label.style_none, textcolor = text_color)
    label.delete(low_label[1])
    
    close_label = label.new(x = bar_index + 70, y = closes, text = text_text + "C", style = label.style_none, textcolor = text_color)
    label.delete(close_label[1])
    
    
if daily_levels
    institution_function("D",daily_line_color,  daily_text_color, "Y")

if weekly_levels
    institution_function("W",weekly_line_color,  weekly_text_color, "LW")
    
if monthly_levels
    institution_function("M",monthly_line_color,  monthly_text_color, "LM")
    
if qtr_levels
    institution_function("3M",qtr_line_color,  qtr_text_color, "LQ")
    
if yearly_levels
    institution_function("12M",yearly_line_color,  yearly_text_color, "LY")
    
    
//TABLE
show_dashboard = input.bool(title='Color Legend', defval=true, inline='1', group='Dashboard Settings')
LabelSize = input.string(defval='Medium', options=['Small', 'Medium', 'Large'], title='Dashboard Size', inline='2', group='Dashboard Settings')
label_size = LabelSize == 'Small' ? size.small : LabelSize == 'Medium' ? size.normal : LabelSize == 'Large' ? size.large : size.small
positioning = position.top_right 
var table t = table.new(positioning, 5, 1,frame_color=color.new(#000000, 100), frame_width=0, border_color=color.new(#000000,100), border_width=0)
if barstate.islast and show_dashboard

    //Column 1
    table.cell(t, 0, 0, text='D', width=0, bgcolor=daily_line_color, text_color=color.white, text_size=label_size, text_halign=text.align_center)
    table.cell(t, 1, 0, text='W', width=0, bgcolor=weekly_line_color, text_color=color.white, text_size=label_size, text_halign=text.align_center)
    table.cell(t, 2, 0, text='M', width=0, bgcolor=monthly_line_color, text_color=color.white, text_size=label_size, text_halign=text.align_center)
    table.cell(t, 3, 0, text='Q', width=0, bgcolor=qtr_line_color, text_color=color.white, text_size=label_size, text_halign=text.align_center)
    table.cell(t, 4, 0, text='Y', width=0, bgcolor=yearly_line_color, text_color=color.white, text_size=label_size, text_halign=text.align_center)

Overview

These levels serve as potential support and resistance for confluence analysis. Users can toggle visibility for each timeframe and customize line and label colors. An optional instructions label explains usage with examples. A dashboard shows color legend when enabled. It draws purely on the price chart with no entry or exit signals.

Details

Published by

g-moe on GitHub

Code credit

goodgains, as written in the script's header

Type

Indicator, Pine Script v5

Draws

On the price chart

Category

Support & resistance, Screeners & dashboards

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
Show Instructionsboolfalseinstructions
Daily Levelsbooltruedaily_levels
Line Colorcolorcolor.new(color.silver, 20)daily_line_color
Label Text Colorcolorcolor.new(color.white, 20)daily_text_color
Weekly Levelsbooltrueweekly_levels
Line Colorcolorcolor.new(color.yellow, 20)weekly_line_color
Label Text Colorcolorcolor.new(color.yellow, 20)weekly_text_color
Monthly Levelsbooltruemonthly_levels
Line Colorcolorcolor.new(color.blue, 20)monthly_line_color
Label Text Colorcolorcolor.new(color.blue, 20)monthly_text_color
Quarterly Levelsbooltrueqtr_levels
Line Colorcolorcolor.new(color.red, 20)qtr_line_color
Show all 18 settings
SettingTypeDefaultVariable
Label Text Colorcolorcolor.new(color.red, 20)qtr_text_color
Yearly Levelsbooltrueyearly_levels
Line Colorcolorcolor.new(color.orange, 20)yearly_line_color
Label Text Colorcolorcolor.new(color.orange, 20)yearly_text_color
Color Legendbooltrueshow_dashboard
Dashboard SizestringMediumLabelSize
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 overlay indicator scans a pasted list of symbols for ICT liquidity sweep patterns using prior swing sweeps. The screening method looks back one, two, or three swings and can list long and short signals in a results table with adjustable rows, position, an

Indicator v5 SMC / ICT / price actionScreeners & dashboards
Updated 1 year ago · MPL-2.0 GitHub repository of ICT Liquidity Sweep Pattern Scanner
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]

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
257 stars

This indicator overlays an intraday SPX and ES chart with a midnight session range, regular-trading-hours opening levels, and a VWAP projection box. It draws the midnight high, mid, and low, flags edge rejections within an absolute tolerance, and plots optiona

Indicator v6 TrendSupport & resistance
Updated 6 weeks ago · None stated GitHub repository of SPX Midnight Box + Snag Logic

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

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