Indicator · Pine Script v6 · On the chart

Stella's Support/Resistance Levels

by stella-entry· code credited to Stella

Stella's Support/Resistance Levels automatically identifies and plots horizontal support and resistance lines on the price chart based on pivot highs and lows.

View on GitHub

GitHub stars3on the repository
Pine versionv6current
Lines of code140
Settings7inputs
LicenceMIT
Last update8 months ago22 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

140 lines of Pine Script v6 from indicators/support-resistance.pine, published under MIT. Keep the author's credit and licence lines when you reuse it.

support-resistance.pine
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Stella

//@version=6
indicator("Stella's Support/Resistance Levels", overlay=true, max_lines_count=500)

// ============================================
// Support & Resistance Levels
// サポート・レジスタンスレベル
// ============================================
// 
// 【English】
// Automatically plots support and resistance levels based on pivot points.
// - Green lines: Support levels (previous lows)
// - Red lines: Resistance levels (previous highs)
// - Dashed lines: Recently broken levels
//
// 【日本語】
// ピボットポイントに基づいてサポート・レジスタンスレベルを自動描画。
// - 緑線: サポートレベル(過去の安値)
// - 赤線: レジスタンスレベル(過去の高値)
// - 破線: 最近ブレイクされたレベル

// ----------------------------------------
// Inputs / 入力パラメータ
// ----------------------------------------

// Pivot settings / ピボット設定
leftBars = input.int(15, "Left Bars / 左本数", minval=1, maxval=100)
rightBars = input.int(15, "Right Bars / 右本数", minval=1, maxval=100)

// Display settings / 表示設定
showSupport = input.bool(true, "Show Support / サポート表示")
showResistance = input.bool(true, "Show Resistance / レジスタンス表示")
maxLines = input.int(10, "Max Lines per Type / 各種最大ライン数", minval=1, maxval=20)

// Style / スタイル
lineWidth = input.int(1, "Line Width / ライン太さ", minval=1, maxval=5)
extendLines = input.bool(false, "Extend Lines / ライン延長")

// ----------------------------------------
// Calculations / 計算
// ----------------------------------------

// Pivot high/low / ピボット高値/安値
ph = ta.pivothigh(high, leftBars, rightBars)
pl = ta.pivotlow(low, leftBars, rightBars)

// ----------------------------------------
// Line Management / ライン管理
// ----------------------------------------

var line[] supportLines = array.new_line(0)
var line[] resistanceLines = array.new_line(0)

// Add new support line / 新しいサポートライン追加
if not na(pl) and showSupport
    newSupport = line.new(bar_index - rightBars, pl, bar_index, pl, 
                           color=color.green, 
                           width=lineWidth,
                           style=extendLines ? line.style_solid : line.style_dashed,
                           extend=extendLines ? extend.right : extend.none)
    array.push(supportLines, newSupport)
    
    // Remove old lines / 古いライン削除
    if array.size(supportLines) > maxLines
        line.delete(array.shift(supportLines))

// Add new resistance line / 新しいレジスタンスライン追加
if not na(ph) and showResistance
    newResistance = line.new(bar_index - rightBars, ph, bar_index, ph,
                              color=color.red,
                              width=lineWidth,
                              style=extendLines ? line.style_solid : line.style_dashed,
                              extend=extendLines ? extend.right : extend.none)
    array.push(resistanceLines, newResistance)
    
    // Remove old lines / 古いライン削除
    if array.size(resistanceLines) > maxLines
        line.delete(array.shift(resistanceLines))

// ----------------------------------------
// Break Detection / ブレイク検出
// ----------------------------------------

// Check for breaks and change style / ブレイク検出してスタイル変更
for i = 0 to array.size(supportLines) - 1
    if i < array.size(supportLines)
        ln = array.get(supportLines, i)
        level = line.get_y1(ln)
        if close < level  // Broken support / ブレイクされたサポート
            line.set_style(ln, line.style_dotted)
            line.set_color(ln, color.new(color.green, 50))

for i = 0 to array.size(resistanceLines) - 1
    if i < array.size(resistanceLines)
        ln = array.get(resistanceLines, i)
        level = line.get_y1(ln)
        if close > level  // Broken resistance / ブレイクされたレジスタンス
            line.set_style(ln, line.style_dotted)
            line.set_color(ln, color.new(color.red, 50))

// ----------------------------------------
// Labels / ラベル
// ----------------------------------------

// Show labels for recent levels / 最近のレベルにラベル表示
if not na(pl) and showSupport
    label.new(bar_index - rightBars, pl, "S", 
              color=color.new(color.green, 80),
              textcolor=color.white,
              style=label.style_label_up,
              size=size.tiny)

if not na(ph) and showResistance
    label.new(bar_index - rightBars, ph, "R",
              color=color.new(color.red, 80),
              textcolor=color.white,
              style=label.style_label_down,
              size=size.tiny)

// ----------------------------------------
// Info Table / 情報テーブル
// ----------------------------------------

var table infoTable = table.new(position.top_right, 2, 3)

if barstate.islast
    // Count active levels / アクティブレベル数
    activeSupport = array.size(supportLines)
    activeResistance = array.size(resistanceLines)
    
    table.cell(infoTable, 0, 0, "Type", bgcolor=color.gray, text_color=color.white)
    table.cell(infoTable, 1, 0, "Count", bgcolor=color.gray, text_color=color.white)
    
    table.cell(infoTable, 0, 1, "Support / サポート", text_color=color.green)
    table.cell(infoTable, 1, 1, str.tostring(activeSupport), text_color=color.green)
    
    table.cell(infoTable, 0, 2, "Resistance / レジスタンス", text_color=color.red)
    table.cell(infoTable, 1, 2, str.tostring(activeResistance), text_color=color.red)

Overview

Stella's Support/Resistance Levels draws green lines at confirmed pivot lows for support and red lines at confirmed pivot highs for resistance. Inputs let users customize the left and right pivot lookback periods, toggle support or resistance lines, adjust line thickness and rightward extension, and limit the maximum number of active lines displayed.

Details

Published by

stella-entry on GitHub

Code credit

Stella, as written in the script's header

Type

Indicator, Pine Script v6

Draws

On the price chart

Category

Support & resistance

Markets

Crypto

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
Left Bars / 左本数int15leftBars
Right Bars / 右本数int15rightBars
Show Support / サポート表示booltrueshowSupport
Show Resistance / レジスタンス表示booltrueshowResistance
Max Lines per Type / 各種最大ライン数int10maxLines
Line Width / ライン太さint1lineWidth
Extend Lines / ライン延長boolfalseextendLines
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