#chat421_sqz_col
#JohnWick4
#7/25
#421
#ALL working hard to build a "Short squeeze indicator for the watchlist." Having a hard time coding this. Would appreciate any help.
# === Short Squeeze Status Indicator (ORB-Style Framework) ===
declare lower;
def o = open;
def h = high;
def l = low;
def c = close;
def x = BarNumber();
def v = volume;
# — Float Proxy —
def liquidity = if volume > 0 then ((close * volume) / 1000000) else Double.NaN;
def isLowFloat = liquidity < 15;
# — Float Rotation Proxy —
#def rotationScore = if liquidityProxy > 0 and (v / liquidityProxy) >= 1 then 1 else 0;
def rotationScore = if liquidity > 0 and (v / liquidity) >= 1 then 1 else 0;
# — Momentum / Volume Filters —
def aboveVWAP = c > vwap();
def rsiMomentum = RSI() > 60 and RSI()[1] < 40;
def volumeSurge = v > Average(v, 30) * 2;
def breakout = c > Highest(h, 10);
# — Composite Short Squeeze Score (0–5) —
#def squeezeScore =
#(isLowFloat ? 1 : 0) +
#(rotationScore) +
#(aboveVWAP ? 1 : 0) +
#(rsiMomentum ? 1 : 0) +
#(volumeSurge ? 1 : 0);
def squeezeScore = isLowFloat +
rotationScore +
aboveVWAP +
rsiMomentum +
volumeSurge;
# — Time-Based Flag: First 30 Minutes —
def Active = GetTime() >= RegularTradingStart(GetYYYYMMDD()) and
GetTime() <= RegularTradingStart(GetYYYYMMDD()) + AggregationPeriod.THIRTY_MIN;
# — First 30-Min High/Low Capture —
def hh = if Active and !Active[1] then h
else if Active and h > hh[1] then h
else hh[1];
def ll = if Active and !Active[1] then l
else if Active and l < ll[1] then l
else ll[1];
# — Breakout Directional Status —
def current = if Between(c, ll, hh) then 0
else if c > hh then 1
else if c < ll then -1
else Double.NaN;
# — Label: Squeeze Score + Breakout Status —
AddLabel(1,
"Squeeze Score: " + squeezeScore + "/5 | " +
(if current == 0 then "In Range"
else if current == 1 then "Breakout ↑"
else if current == -1 then "Breakout ↓"
else "N/A"),
if squeezeScore >= 4 then Color.RED
else if squeezeScore >= 2 then Color.ORANGE
else Color.GRAY);
# — Background Color —
#AssignBackgroundColor(
#if squeezeScore >= 4 then CreateColor(255, 0, 0)
#else if squeezeScore >= 2 then CreateColor(255, 140, 0)
#else CreateColor(80, 80, 80));
addlabel(1, " " + squeezeScore + " ",
if squeezeScore >= 4 then CreateColor(255, 0, 0)
else if squeezeScore >= 2 then CreateColor(255, 140, 0)
else CreateColor(80, 80, 80));
#