Short Squeeze Indicator — Free Pine Script v6 for TradingView
- short-squeeze-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
About this product
Short Squeeze Indicator is a free Pine Script v6 indicator by Script Master Labs. It detects the compression-then-expansion chart signature of short-covering episodes and scores it. 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 the chart signature that accompanies short-covering episodes: a period of volatility compression — Bollinger Band width at a low percentile of its recent history — followed by a fast upside expansion on rising relative volume, combined into a descriptive Squeeze Pressure Score. It cannot observe short interest, share float, or borrow fees — TradingView provides none of that data — and the score is descriptive arithmetic over chart data, never a probability.
How to use it
Open TradingView's Pine Editor, create a new blank script, 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/short-squeeze-indicator, $29 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 — free Pine Script v6 indicators and strategies, free trading calculators 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
Short Squeeze Indicator is a free Pine Script v6 indicator by Script Master Labs. It detects the compression-then-expansion chart signature of short-covering episodes and scores it. 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.
// © 2026 Script Master Labs LLC — Short Squeeze Indicator for TradingView
// Research-based, original SML engineering.
//
// WHAT THIS SCRIPT DOES — AND WHAT IT CANNOT DO (read this first):
// A chart indicator CANNOT observe short interest, share float, or borrow
// fees. TradingView provides none of that data for most symbols, and this
// script uses none of it. What this script measures is the CHART SIGNATURE
// that accompanies short-covering episodes: a period of volatility
// compression followed by a fast upside expansion on rising relative
// volume. It detects and marks that signature mechanically. It makes no
// prediction and no profitability claim. Crowded-short conditions have
// preceded declines as well as squeezes, and a fast upside expansion can
// occur for reasons that have nothing to do with short covering. The
// Squeeze Pressure Score is descriptive arithmetic over chart data —
// it is never a probability.
//
// MECHANICAL DEFINITION (exactly as implemented below):
// 1) Compression: Bollinger Band width (BB 20, 2 stdev, expressed as a
// percentage of the BB basis) at or below its compressionPct percentile
// of its last pctLen bars (rolling percentile, linear interpolation).
// Compression is "present in the lookback" when at least compressionBars
// of the last lookback bars were compressed.
// 2) Expansion (squeeze event) bar: close - close[moveBars] >=
// moveMult * ATR(14) AND relative volume RVOL = volume / SMA(volume,20)
// >= rvolMin. On symbols with no volume data, the RVOL test is treated
// as satisfied and the table shows RVOL as n/a (disclosed, not hidden).
// 3) Squeeze Pressure Score (0-100):
// score = 40*min(1, moveAtr/(2*moveMult)) + 35*min(1, rvol/4)
// + 25*(compression present in lookback ? 1 : 0),
// where moveAtr = max(0, (close - close[moveBars]) / ATR(14)).
// On no-volume symbols the RVOL term contributes 0 (there is no volume
// to measure). The score is rounded to an integer.
// Markers are drawn on expansion events only, on confirmed bars only;
// a drawn event never moves and never disappears.
//@version=6
indicator("SML Short Squeeze Indicator", shorttitle = "SML Squeeze Sig", overlay = true, max_labels_count = 500)
// ── Inputs: Detection ───────────────────────────────────────────────────────
grpDetect = "Detection"
bbLen = input.int(20, "Bollinger Band length", minval = 5, maxval = 100, group = grpDetect)
bbMult = input.float(2.0, "Bollinger Band multiplier (stdev)", minval = 0.5, step = 0.1, group = grpDetect)
pctLen = input.int(100, "Percentile lookback (bars of BB width)", minval = 20, maxval = 500, group = grpDetect)
compressionPct = input.float(25.0, "Compression percentile (BB width at or below)", minval = 1.0, maxval = 99.0, step = 1.0, group = grpDetect)
compressionBars = input.int(3, "Minimum compressed bars in lookback", minval = 1, maxval = 50, group = grpDetect)
lookback = input.int(20, "Compression lookback (bars)", minval = 1, maxval = 200, group = grpDetect)
moveBars = input.int(3, "Expansion move window (bars)", minval = 1, maxval = 20, group = grpDetect)
moveMult = input.float(1.5, "Expansion move threshold (x ATR 14)", minval = 0.1, step = 0.1, group = grpDetect)
rvolMin = input.float(2.0, "Minimum RVOL (volume / SMA(volume,20))", minval = 0.1, step = 0.1, group = grpDetect)
atrLen = input.int(14, "ATR length", minval = 2, maxval = 50, group = grpDetect)
// ── Inputs: Display ─────────────────────────────────────────────────────────
grpDisplay = "Display"
showWidthPlot = input.bool(true, "Show BB width + threshold in data window", group = grpDisplay)
widthColor = input.color(color.new(color.aqua, 0), "BB width line color", group = grpDisplay)
widthLineSize = input.int(1, "BB width line width", minval = 1, maxval = 4, group = grpDisplay)
thrColor = input.color(color.new(color.orange, 0), "Compression threshold line color", group = grpDisplay)
thrLineSize = input.int(1, "Threshold line width", minval = 1, maxval = 4, group = grpDisplay)
markerColor = input.color(color.new(color.lime, 0), "Event marker color", group = grpDisplay)
// ── Inputs: Markers ─────────────────────────────────────────────────────────
grpMarker = "Markers"
markerShape = input.string("Arrow", "Event marker shape", options = ["Arrow", "Triangle"], group = grpMarker)
markerSizeIn = input.string("Small", "Event marker size", options = ["Tiny", "Small"], group = grpMarker)
labelMode = input.string("Buy/Sell", "Event marker label mode", options = ["Buy/Sell", "Call/Put"], group = grpMarker)
// ── Inputs: Table ───────────────────────────────────────────────────────────
grpTable = "Table"
showTable = input.bool(true, "Show data table", group = grpTable)
tablePosIn = input.string("Top Right", "Table position", options = ["Top Right", "Top Left", "Bottom Right", "Bottom Left", "Middle Right", "Middle Left"], group = grpTable)
tableSizeIn = input.string("Small", "Table text size", options = ["Tiny", "Small", "Normal"], group = grpTable)
tablePos = tablePosIn == "Top Left" ? position.top_left : tablePosIn == "Bottom Right" ? position.bottom_right : tablePosIn == "Bottom Left" ? position.bottom_left : tablePosIn == "Middle Right" ? position.middle_right : tablePosIn == "Middle Left" ? position.middle_left : position.top_right
tableTextSize = tableSizeIn == "Tiny" ? size.tiny : tableSizeIn == "Normal" ? size.normal : size.small
markerSize = markerSizeIn == "Tiny" ? size.tiny : size.small
markerStyle = markerShape == "Triangle" ? label.style_triangleup : label.style_label_up
markerText = labelMode == "Call/Put" ? "CALL" : "BUY"
// ── Compression ─────────────────────────────────────────────────────────────
bbBasis = ta.sma(close, bbLen)
bbDev = bbMult * ta.stdev(close, bbLen)
bbWidthPct = not na(bbBasis) and bbBasis != 0 ? (2.0 * bbDev) / bbBasis * 100.0 : na
widthThr = ta.percentile_linear_interpolation(bbWidthPct, pctLen, compressionPct)
compressed = not na(bbWidthPct) and not na(widthThr) and bbWidthPct <= widthThr
compressedCount = math.sum(compressed ? 1 : 0, lookback)
compressionInLookback = compressedCount >= compressionBars
// ── Expansion ───────────────────────────────────────────────────────────────
atr14 = ta.atr(atrLen)
moveRaw = close - close[moveBars]
moveAtr = not na(atr14) and atr14 > 0 ? math.max(0.0, moveRaw / atr14) : 0.0
hasVolume = not na(volume)
volSma = ta.sma(volume, 20)
rvol = hasVolume and not na(volSma) and volSma > 0 ? volume / volSma : na
rvolOk = not hasVolume or (not na(rvol) and rvol >= rvolMin)
moveOk = not na(atr14) and moveRaw >= moveMult * atr14
squeezeEvent = compressionInLookback and moveOk and rvolOk
// ── Squeeze Pressure Score (0-100, descriptive arithmetic only) ────────────
rvolForScore = hasVolume and not na(rvol) ? rvol : 0.0
scoreRaw = 40.0 * math.min(1.0, moveAtr / (2.0 * moveMult)) + 35.0 * math.min(1.0, rvolForScore / 4.0) + (compressionInLookback ? 25.0 : 0.0)
pressureScore = int(math.round(scoreRaw))
// ── Markers (confirmed bars only; events never move or disappear) ──────────
var int lastEventBar = na
if barstate.isconfirmed and squeezeEvent
lastEventBar := bar_index
label.new(bar_index, low, text = markerText, style = markerStyle, size = markerSize, color = markerColor, textcolor = color.white)
barsSinceEvent = na(lastEventBar) ? na : bar_index - lastEventBar
// ── Data-window plots ───────────────────────────────────────────────────────
plot(showWidthPlot ? bbWidthPct : na, "BB width % of price", color = widthColor, linewidth = widthLineSize, display = display.data_window)
plot(showWidthPlot ? widthThr : na, "Compression threshold (percentile)", color = thrColor, linewidth = thrLineSize, display = display.data_window)
plot(pressureScore, "Squeeze Pressure Score (0-100)", display = display.data_window)
plot(moveAtr, "Move (x ATR)", display = display.data_window)
plot(rvol, "RVOL", display = display.data_window)
// ── Table (all text white) ──────────────────────────────────────────────────
var table infoTable = na
if showTable and na(infoTable)
infoTable := table.new(tablePos, 2, 6, bgcolor = color.new(color.black, 15), border_width = 1, border_color = color.white)
if showTable and barstate.islast
table.cell(infoTable, 0, 0, "SML SQUEEZE", text_color = color.white, text_size = tableTextSize)
table.cell(infoTable, 1, 0, "", text_color = color.white, text_size = tableTextSize)
table.cell(infoTable, 0, 1, "Pressure Score", text_color = color.white, text_size = tableTextSize)
table.cell(infoTable, 1, 1, str.tostring(pressureScore), text_color = color.white, text_size = tableTextSize)
table.cell(infoTable, 0, 2, "Move (x ATR)", text_color = color.white, text_size = tableTextSize)
table.cell(infoTable, 1, 2, str.tostring(moveAtr, "#.##"), text_color = color.white, text_size = tableTextSize)
table.cell(infoTable, 0, 3, "RVOL", text_color = color.white, text_size = tableTextSize)
table.cell(infoTable, 1, 3, hasVolume and not na(rvol) ? str.tostring(rvol, "#.##") : "n/a", text_color = color.white, text_size = tableTextSize)
table.cell(infoTable, 0, 4, "Compression", text_color = color.white, text_size = tableTextSize)
table.cell(infoTable, 1, 4, compressionInLookback ? "Yes" : "No", text_color = color.white, text_size = tableTextSize)
table.cell(infoTable, 0, 5, "Last event (bars ago)", text_color = color.white, text_size = tableTextSize)
table.cell(infoTable, 1, 5, na(barsSinceEvent) ? "none yet" : str.tostring(barsSinceEvent), text_color = color.white, text_size = tableTextSize)
// ── Alerts (descriptive only — a detected chart signature, not a trade call) ─
alertcondition(squeezeEvent, title = "Squeeze signature event", message = "Short Squeeze Indicator: compression-then-expansion signature detected on {{exchange}}:{{ticker}} ({{interval}}). Pressure Score {{plot_2}}. This is a chart-pattern record, not a prediction.")
Questions about this product
Is there a free Pine Script for short squeeze setups on TradingView?
Yes. Script Master Labs publishes this Short Squeeze Indicator as a free Pine Script v6 download on SML Dual Market (https://dual.scriptmasterlabs.com/product/free-short-squeeze-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 Short Squeeze Indicator?
Open TradingView's Pine Editor, create a new blank script, 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 ($29 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.