SML Dual Market
Instant download · 7-day refunds on every product — see the refund policy · Veteran-owned small business
Support & Resistance Indicator — Free Pine Script v6 for TradingViewSupport & Resistance Indicator — Free Pine Script v6 for TradingView — ZIP bundle cover

Support & Resistance Indicator — Free Pine Script v6 for TradingView

Free
Get it free
Free · instant download on claim · no account · signed receipt — how buying works →
Sold byScript Master Labs LLC (SDVOSB · UEI G24VZA4RLMK3 · CAGE 21U51)
File checkedWe test-download every product before it's listed (last checked Dec 4, 2026).
UpdatedDec 4, 2026
No account needed. Your download link appears right after checkout — bookmark it.
You get exactly this
free-support-and-resistance-indicator.zip — complete Pine Script v6 source + install README + free license (free edition)
What's inside
ZIP — Pine Script v6 source (.pine), install README, free license
  • support-and-resistance-indicator.pine — the complete Pine Script v6 source
  • README-FIRST.md — what it does and how to install it
  • FREE-LICENSE.md — the free-edition license terms
Delivered as one download, the moment you claim it — no payment, no account.

About this product

Support & Resistance Indicator is a free Pine Script v6 indicator by Script Master Labs. It finds pivot-based support and resistance levels and counts how often price reacted at them. The complete source is printed in full on this page and in the free download — paste it into TradingView's Pine Editor and it runs on TradingView's free plan. No payment, no account, no subscription.

What it computes, in its own terms: it pivot-based support and resistance levels: it finds pivot highs and lows and counts how often price reacted at each level. A level is a record of where price turned before; it is not a promise that price will turn there again.

How to use it

Open TradingView's Pine Editor, create a new blank indicator, paste the source, save, and click Add to chart. Adjust the inputs from the gear icon. The full source is printed on this page below, and the free download carries the same source file with an install README and the free-edition license.

Free edition vs paid edition

The script file is the complete indicator — the same Pine Script v6 source sold in the paid edition (https://dual.scriptmasterlabs.com/product/support-and-resistance-indicator, $19 one-time). The paid edition adds the full written user guide, the evidence receipt, and the licensing and security reviews. Nothing in the script is held back from the free edition.

More free tools — five free Pine Script v6 indicators and a free x402 pre-payment trust check — are collected on the Free Tools hub. Educational software, not financial advice: it measures and draws a stated rule; it does not predict price and shows no win rate.

The complete Pine Script v6 source — free, on this page

Support & Resistance Indicator is a free Pine Script v6 indicator by Script Master Labs. It finds pivot-based support and resistance levels and counts how often price reacted at them. The complete source is printed in full on this page and in the free download — paste it into TradingView's Pine Editor and it runs on TradingView's free plan. No payment, no account, no subscription.

Copy it into TradingView's Pine Editor (new blank indicator → paste → Save → Add to chart), or claim the free download above for the same source as a file with an install README. Educational software, not financial advice.

// © 2026 Script Master Labs LLC — Support and Resistance Indicator
// Research-based, original SML engineering. This indicator FINDS pivot-based
// price levels and counts how often price reacted at them. A level is a
// record of where price turned before; it is not a promise that price will
// turn there again.
//@version=6
indicator("SML Support and Resistance Indicator", shorttitle = "SML S&R", overlay = true, max_lines_count = 500, max_boxes_count = 500, max_labels_count = 500)

// ── Inputs ──────────────────────────────────────────────────────────────────
pivotLen    = input.int(5, "Pivot length (bars each side)", minval = 1, maxval = 20)
maxLevels   = input.int(6, "Maximum resistance + support levels shown", minval = 1, maxval = 12)
zoneAtrMult = input.float(0.25, "Zone half-height / merge tolerance (× ATR 14)", minval = 0.0, step = 0.05)
extendBars  = input.int(100, "Extend level zones this many bars right", minval = 10, maxval = 500)
showLabels  = input.bool(true, "Label each level with price + touch count")
resColor    = input.color(color.new(color.red, 85), "Resistance zone fill")
supColor    = input.color(color.new(color.teal, 85), "Support zone fill")

// ── Pivot detection ─────────────────────────────────────────────────────────
ph = ta.pivothigh(high, pivotLen, pivotLen)   // non-na on the confirmation bar, value = pivot price
pl = ta.pivotlow(low, pivotLen, pivotLen)
atr14 = ta.atr(14)
tol = zoneAtrMult * atr14

// ── Level storage (parallel arrays) ─────────────────────────────────────────
// price = running mean of merged pivot prices; touches = merged pivot count.
var float[] lvlPrice   = array.new_float()
var int[]   lvlTouches = array.new_int()
var bool[]  lvlIsRes   = array.new_bool()
var box[]   lvlBoxes   = array.new_box()
var label[] lvlLabels  = array.new_label()

f_redraw() =>
    // Delete all drawings and rebuild from the arrays (keeps code simple and
    // guarantees the chart always matches the stored state).
    for b in lvlBoxes
        box.delete(b)
    for l in lvlLabels
        label.delete(l)
    array.clear(lvlBoxes)
    array.clear(lvlLabels)
    n = array.size(lvlPrice)
    if n > 0
        for i = 0 to n - 1
            p = array.get(lvlPrice, i)
            isRes = array.get(lvlIsRes, i)
            h = math.max(tol, syminfo.mintick * 2)
            b = box.new(bar_index - 200, p + h, bar_index + extendBars, p - h, border_color = color.new(isRes ? color.red : color.teal, 40), bgcolor = isRes ? resColor : supColor)
            array.push(lvlBoxes, b)
            if showLabels
                txt = (isRes ? "R " : "S ") + str.tostring(p, format.mintick) + " · " + str.tostring(array.get(lvlTouches, i)) + " touches"
                array.push(lvlLabels, label.new(bar_index + 2, p, txt, style = isRes ? label.style_label_down : label.style_label_up, color = color.new(isRes ? color.red : color.teal, 20), textcolor = color.white, size = size.small))

f_add_level(_price, _isRes) =>
    // Merge into an existing same-side level within tolerance, else append.
    merged = false
    n = array.size(lvlPrice)
    if n > 0
        for i = 0 to n - 1
            if array.get(lvlIsRes, i) == _isRes and math.abs(array.get(lvlPrice, i) - _price) <= tol
                oldT = array.get(lvlTouches, i)
                array.set(lvlPrice, i, (array.get(lvlPrice, i) * oldT + _price) / (oldT + 1))
                array.set(lvlTouches, i, oldT + 1)
                merged := true
                break
    if not merged
        array.push(lvlPrice, _price)
        array.push(lvlTouches, 1)
        array.push(lvlIsRes, _isRes)
    // Cap the count: drop the level with the fewest touches (ties: oldest).
    while array.size(lvlPrice) > maxLevels * 2
        dropIdx = 0
        minT = array.get(lvlTouches, 0)
        for i = 1 to array.size(lvlPrice) - 1
            if array.get(lvlTouches, i) < minT
                minT := array.get(lvlTouches, i)
                dropIdx := i
        array.remove(lvlPrice, dropIdx)
        array.remove(lvlTouches, dropIdx)
        array.remove(lvlIsRes, dropIdx)
    f_redraw()

if not na(ph)
    f_add_level(ph, true)
if not na(pl)
    f_add_level(pl, false)

// ── Break detection (close-based) ───────────────────────────────────────────
// A resistance level is "broken" when a bar CLOSES above the zone top; a
// support level when a bar closes below the zone bottom. The level is then
// removed (its role may flip in reality; this indicator does not relabel it
// automatically — the next pivots decide).
var bool brokeRes = false
var bool brokeSup = false
brokeRes := false
brokeSup := false
if barstate.isconfirmed and array.size(lvlPrice) > 0
    i = array.size(lvlPrice) - 1
    removed = false
    while i >= 0
        p = array.get(lvlPrice, i)
        if array.get(lvlIsRes, i) and close > p + tol
            brokeRes := true
            array.remove(lvlPrice, i)
            array.remove(lvlTouches, i)
            array.remove(lvlIsRes, i)
            removed := true
        else if not array.get(lvlIsRes, i) and close < p - tol
            brokeSup := true
            array.remove(lvlPrice, i)
            array.remove(lvlTouches, i)
            array.remove(lvlIsRes, i)
            removed := true
        i -= 1
    if removed
        f_redraw()

alertcondition(brokeRes, title = "Close above resistance", message = "Price closed above a tracked resistance level on {{exchange}}:{{ticker}} ({{interval}}).")
alertcondition(brokeSup, title = "Close below support", message = "Price closed below a tracked support level on {{exchange}}:{{ticker}} ({{interval}}).")
Frequently paired

Questions about this product

Is there a free Pine Script for support and resistance levels on TradingView?

Yes. Script Master Labs publishes this Support & Resistance Indicator as a free Pine Script v6 download on SML Dual Market (https://dual.scriptmasterlabs.com/product/free-support-and-resistance-indicator). The complete source is printed in full on the product page and in the free download — no payment, no account, no subscription.

How do I use the Support & Resistance Indicator?

Open TradingView's Pine Editor, create a new blank indicator, paste the source, click Save, then Add to chart. Adjust the inputs from the gear icon. TradingView's first-steps page shows where the editor opens: https://tradingview.com/pine-script-docs/primer/first-steps

Does it work on TradingView's free plan?

Yes. Paste the source into TradingView's Pine Editor and add it to your chart; the free plan runs custom indicators.

Is the free edition the complete script?

Yes — the same Pine Script v6 source file sold in the paid edition ($19 one-time). The paid edition adds the full written user guide, the evidence receipt, and the licensing and security reviews; nothing in the script itself is held back.