Entry/Exit Signals (Options Trading)

Adeodatus

Active member
Plus
Entry is nearly as important as exit, and options trading strategies use quantitative measures, known as Greeks (delta, gamma, theta, vega, and rho) data to set the numbers. I'm searching for the indicator to chart out the Delta on the Equity chart.
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Entry is nearly as important as exit, and options trading strategies use quantitative measures, known as Greeks (delta, gamma, theta, vega, and rho) data to set the numbers. I'm searching for the indicator to chart out the Delta on the Equity chart.
Not sure TOS will allow straight up "delta" charting plus charting raw Delta (the Greek) as a momentum or directional indicator is usually misleading and often completely wrong, especially on short-term charts. The Only Two Times Option Delta Is Actually Useful on a Chart
  1. As a probability proxy (not momentum), A 0.16 Delta put ~ 1 standard deviation OTM ~ 16% chance of finishing ITM- Use it for positioning, not timing.
  2. Cumulative Volume Delta (CVD) or Order-Flow Delta (not the Greek), This is what pros actually watch (trade-by-trade buy vs sell volume at bid/ask), Thinkorswim shows this in the Time & Sales with color-coding, or via third-party tools (Bookmap, Jigsaw, Sierra Chart).
Charting raw option Delta (the Greek) as a directional or momentum signal is almost always skewed, overvalued in spikes, and undervalued in chop. It is one of the most over-hyped and misused indicators in retail options

VWAP + Volume Profile still beats raw option Delta 9 times out of 10.

That being said, "Have I got a DEAL for you!!!!" Why I Love This "Delta-Like" Version
  • It’s cleaner and more honest than Cumulative Delta (which can be manipulated by order flow tools)
  • The % format makes it instantly comparable across all stocks (AAPL at +30% delta means the same strength as a penny stock at +30%)
  • The background heat map gives you instant visual bias — no thinking required
  • Works beautifully on daily, 1H, 15M, 5M — anywhere
Best Use Cases
  • Spot short squeezes forming (price flat, Delta spiking green)
  • Catch distribution tops (price making new highs, Delta going red = smart money exiting)
  • Confirm breakouts (price breaks out + Delta surging green = high-probability move)
This is one of the cleanest, most powerful volume-based conviction tools you can run in Thinkorswim. When DeltaFlow goes positive and stays there — especially on low volatility — something big is usually coming.
You just got handed a pro-level institutional edge. Use it well, Grasshopper!


Code:
###############################################
# DeltaFlow Subgraph – PRO VERSION WITH SMART LABELS
# Real-world institutional interpretation built-in
###############################################

declare lower;

input lookBack = 200;
input showDelta = yes;
input showVolume = yes;

DefineGlobalColor("bull",    CreateColor(0, 160, 160));   # teal
DefineGlobalColor("bear",    CreateColor(230, 150, 30));  # orange
DefineGlobalColor("neutral", Color.GRAY);

# --- Bullish / Bearish volume per bar
def bullVol = if close > open then volume else 0;
def bearVol = if close < open then volume else 0;

# --- Rolling sums
def bullSum  = Sum(bullVol, lookBack);
def bearSum  = Sum(bearVol, lookBack);
def totalVol = Sum(volume, lookBack);

# --- Core Delta % (net buying pressure)
def delta = if totalVol != 0 then (bullSum - bearSum) / totalVol * 100 else 0;

# --- Plots
plot BullVolPlot = if showVolume then  bullSum  / totalVol * 100 else Double.NaN;
plot BearVolPlot = if showVolume then -bearSum  / totalVol * 100 else Double.NaN;
plot DeltaLine   = if showDelta then delta else Double.NaN;

BullVolPlot.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
BearVolPlot.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
DeltaLine.SetPaintingStrategy(PaintingStrategy.LINE);
DeltaLine.SetLineWeight(3);

BullVolPlot.SetDefaultColor(GlobalColor("bull"));
BearVolPlot.SetDefaultColor(GlobalColor("bear"));
DeltaLine.SetDefaultColor(Color.WHITE);



# =============================================================================
# SMART INTERPRETATION LABELS – This is what you asked for
# =============================================================================

def deltaRising     = delta > delta[1];
def deltaFalling    = delta < delta[1];
def priceFlatOrDown = close <= Highest(close, 20)[5];  # price not making new highs recently

AddLabel(yes, "DeltaFlow", Color.WHITE);

# MAIN STATUS LABEL – BIG & BOLD
AddLabel(yes,
    if delta >= 20 then "STRONG ACCUMULATION – Smart Money Buying Heavily"
    else if delta >= 10 then "Moderate Buying Pressure – Healthy Uptrend"
    else if delta > 0 and deltaRising and priceFlatOrDown then "HIDDEN ACCUMULATION – Pre-Squeeze Setup"
    else if delta > 0 then "Mild Bullish Control"
    else if delta <= -20 then "HEAVY DISTRIBUTION – Smart Money Selling"
    else if delta <= -10 then "Moderate Selling Pressure – Caution"
    else if delta < 0 and deltaFalling and !priceFlatOrDown then "DISTRIBUTION INTO STRENGTH – Bearish Warning"
    else "Neutral / Chop Zone",

    if delta >= 20 then CreateColor(0, 100, 0)           # dark green
    else if delta >= 10 then Color.CYAN
    else if delta > 0 and deltaRising and priceFlatOrDown then CreateColor(0, 180, 180)  # bright teal
    else if delta > 0 then GlobalColor("bull")
    else if delta <= -20 then CreateColor(120, 0, 0)     # dark red
    else if delta <= -10 then Color.MAGENTA
    else Color.GRAY
);

# DELTA VALUE LABEL
AddLabel(yes, "Δ " + Round(delta, 1) + "%",
    if delta >= 20 then Color.WHITE
    else if delta >= 10 then GlobalColor("bull")
    else if delta <= -20 then Color.WHITE
    else if delta <= -10 then GlobalColor("bear")
    else GlobalColor("neutral")
);

# TREND CONTEXT LABEL
AddLabel(yes,
    if priceFlatOrDown and deltaRising and delta > 5 then "CLASSIC HIDDEN BULL SETUP"
    else if !priceFlatOrDown and deltaFalling and delta < -10 then "DISTRIBUTION TOP FORMING"
    else "",
    if priceFlatOrDown and deltaRising then Color.YELLOW else Color.DARK_ORANGE
);
 
Another one I like that is real time and can run on any timed chart is the BollingerbandPercent this is a great partner with the delta script above - love this one

Code:
# Bollinger %B with Buy/Sell Arrows
declare lower;

def percentB = BollingerPercentB()."PercentB";

plot PB = percentB;
PB.SetLineWeight(2);

plot Upper = 1.0;
plot Lower = 0.0;
plot Mid   = 0.5;

Upper.SetDefaultColor(Color.RED);
Lower.SetDefaultColor(Color.GREEN);
Mid.SetDefaultColor(Color.GRAY);

# Signals
plot Buy  = if Crosses(percentB, 0, CrossingDirection.ABOVE) then 0 else Double.NaN;
plot Sell = if Crosses(percentB, 1, CrossingDirection.BELOW) then 1 else Double.NaN;

Buy.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
Buy.SetDefaultColor(Color.CYAN);
Buy.SetLineWeight(4);

Sell.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
Sell.SetDefaultColor(Color.MAGENTA);
Sell.SetLineWeight(4);
 
The concept is Folds, the "else Power", so the decay
factor (theta) is used in the swing trade linear and day trade exponential data.
The bottom chart a theortical Greek flow. I tried.

Delta unavailable. Delta Proxy:
-def sDelta = if Highest(CumDelta, scoreLookback) - Lowest(CumDelta, scoreLookback) == 0 then 0 else (CumDelta - Lowest(CumDelta, scoreLookback)) / (Highest(CumDelta, scoreLookback) - Lowest(CumDelta, scoreLookback)); Think of a weighed Sum calculation. Now combine Sum with the Total, and we are looking at the Alpha.

-input gammaLen = 3;
-input vegaBBLength = 20;
-input vegaNumSD = 2.0;

scoreLookback = 50 (could be 9, 20 or 200)

and the Theta Proxy:
def sTheta = if Highest(sThetaRaw, scoreLookback) - Lowest(sThetaRaw, scoreLookback) == 0 then 0 else (sThetaRaw - Lowest(sThetaRaw, scoreLookback)) / (Highest(sThetaRaw, scoreLookback) - Lowest(sThetaRaw, scoreLookback));


2025-11-25-TOS_CHARTSA.png
 

How to Interpret:
  • Alpha > 0.70 → Strong aggressive buying + gamma squeeze potential (big green flow)
  • Alpha > 0.55 → Bullish flow, worth swinging long
  • Alpha 0.45–0.55 → Neutral / chop
  • Alpha < 0.45 → Bearish flow or theta bleed dominating
  • Alpha < 0.30 → Heavy distribution or gamma dump
Suggested tweaks you can play with:
  • Change scoreLookback (9 = very short-term scalping, 50 = day/swing, 200 = positional)
  • Increase gammaLen if you want smoother gamma proxy
  • Flip sTheta sign or weight if you’re mostly short premium
This won’t be as good as real-time COTD/GEX data from vendors like Bookmap or Tier1Alpha, but on ThinkOrSwim (and most retail platforms), this is one of the strongest synthetic Greek flow approximations you can build.

Code:
# Folds – Synthetic Greek Flow Alpha (Nov 2025)
# ADEODATUS/ANTWERKS

declare lower;

# ───── Inputs ─────
input scoreLookback   = 50;   # 9, 20, 50, 200
input gammaLen        = 3;
input vegaBBLength    = 20;
input vegaNumDev      = 2.0;
input weightDelta     = 0.40;
input weightGamma     = 0.25;
input weightVega      = 0.20;
input weightTheta     = 0.15;

# ───── 1. Cumulative Volume Delta Proxy (UpVol - DnVol) ─────
def upVol   = if close >= open then volume else 0;
def dnVol   = if close <  open then volume else 0;
def volDelta = upVol - dnVol;
def CumDelta = TotalSum(volDelta);

# Scaled Delta (0 to 1)
def deltaHi = Highest(CumDelta, scoreLookback);
def deltaLo = Lowest(CumDelta, scoreLookback);
def sDelta = if (deltaHi - deltaLo) == 0 then 0.5
             else (CumDelta - deltaLo) / (deltaHi - deltaLo);

# ───── 2. Theta Proxy – price “decay speed” relative to recent average ─────
def move    = AbsValue(close - close[1]);
def avgMove = Average(move, scoreLookback);
def decay   = if avgMove > 0 then (move - avgMove) / avgMove else 0;
def thetaRaw = -decay;   # negative when price is stalling → theta bleed

def thetaHi = Highest(thetaRaw, scoreLookback);
def thetaLo = Lowest(thetaRaw, scoreLookback);
def sTheta = if (thetaHi - thetaLo) == 0 then 0.5
             else (thetaRaw - thetaLo) / (thetaHi - thetaLo);

# ───── 3. Gamma Proxy – acceleration of momentum (convexity proxy) ─────
def mom1 = close - close[1];
def mom2 = mom1 - mom1[1];
def gammaRaw = Average(mom2, gammaLen);

def gammaHi = Highest(gammaRaw, scoreLookback);
def gammaLo = Lowest(gammaRaw, scoreLookback);
def sGamma = if (gammaHi - gammaLo) == 0 then 0.5
             else (gammaRaw - gammaLo) / (gammaHi - gammaLo);

# ───── 4. Vega Proxy – Bollinger Band %B width (volatility regime) ─────
def basis   = Average(close, vegaBBLength);
def dev     = vegaNumDev * StDev(close, vegaBBLength);
def upper   = basis + dev;
def lower   = basis - dev;
def bbWidth = (upper - lower) / basis;   # normalized width

def vegaHi = Highest(bbWidth, scoreLookback);
def vegaLo = Lowest(bbWidth, scoreLookback);
def sVega = if (vegaHi - vegaLo) == 0 then 0.5
            else (bbWidth - vegaLo) / (vegaHi - vegaLo);

# ───── Final Alpha – "Folds / Else Power" ─────
def Alpha = weightDelta * sDelta +
            weightGamma * sGamma +
            weightVega  * sVega +
            weightTheta * sTheta;

# ───── Plotting ─────
plot Zero = 0;
Zero.SetDefaultColor(Color.DARK_GRAY);
Zero.SetStyle(Curve.SHORT_DASH);

plot AlphaLine = Alpha;
AlphaLine.SetLineWeight(3);
AlphaLine.AssignValueColor(
    if Alpha >= 0.70 then Color.UPTICK
    else if Alpha >= 0.55 then Color.GREEN
    else if Alpha <= 0.30 then Color.MAGENTA
    else if Alpha <= 0.45 then Color.RED
    else Color.GRAY
);

plot Hist = Alpha;
Hist.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Hist.SetLineWeight(3);
Hist.AssignValueColor(
    if Alpha >= 0.70 then Color.UPTICK
    else if Alpha >= 0.55 then Color.GREEN
    else if Alpha <= 0.30 then Color.MAGENTA
    else if Alpha <= 0.45 then Color.RED
    else Color.GRAY
);

plot OB = 0.75;
plot OS = 0.25;
OB.SetDefaultColor(Color.RED);
OS.SetDefaultColor(Color.GREEN);
OB.HideTitle();
OS.HideTitle();

# Optional labels – conditional color via if/then
AddLabel(yes, "Alpha: " + Round(Alpha, 3),
    if Alpha >= 0.70 then Color.UPTICK
    else if Alpha >= 0.55 then Color.GREEN
    else if Alpha <= 0.30 then Color.MAGENTA
    else if Alpha <= 0.45 then Color.RED
    else Color.GRAY
);

# ───── DEFINITIVE INTERPRETATION LABEL (this is what you wanted) ─────
AddLabel(yes,
    if Alpha >= 0.70 then "VERY STRONG BULLISH FLOW – GO LONG / ADD"
    else if Alpha >= 0.55 then "BULLISH BIAS – GOOD LONG SETUP"
    else if Alpha >= 0.45 then "CHOP / WAIT – NO CLEAR EDGE"
    else if Alpha >= 0.30 then "BEARISH / CAUTION – DISTRIBUTION"
    else "HEAVY DISTRIBUTION – SHORT OR STAND ASIDE",
    if Alpha >= 0.70 then Color.UPTICK
    else if Alpha >= 0.55 then Color.GREEN
    else if Alpha <= 0.30 then Color.MAGENTA
    else if Alpha <= 0.45 then Color.RED
    else Color.GRAY
);

1764089713466.png
 
  • Alpha > 0.70 → Strong aggressive buying + gamma squeeze potential (big green flow)
  • Alpha > 0.55 → Bullish flow, worth swinging long
  • Alpha 0.45–0.55 → Neutral / chop
  • Alpha < 0.45 → Bearish flow or theta bleed dominating
  • Alpha < 0.30 → Heavy distribution or gamma dump
Suggested tweaks you can play with:
  • Change scoreLookback (9 = very short-term scalping, 50 = day/swing, 200 = positional)
  • Increase gammaLen if you want smoother gamma proxy
  • Flip sTheta sign or weight if you’re mostly short premium
Code:
# Folds – Synthetic Greek Flow Alpha (Nov 2025)
# ADEODATUS/ANTWERKS

[ATTACH type="full" alt="1764089713466.png"]26327[/ATTACH]
[/QUOTE]
THat is some Likeable coding!  Check XOM lined up on the A_ProxEngineV2 on the daily chart [ATTACH type="full"]26328[/ATTACH]
 

Attachments

  • 2025-11-25-TOS_CHARTSXOM2.png
    2025-11-25-TOS_CHARTSXOM2.png
    560.4 KB · Views: 24
Code:
# ================================================================
# FOLD–POWER ALPHA ENGINE — MERGED PRO (compiled, visuals, bubbles)
# - Delta proxy, Theta proxy, Fold/Power blending
# - Vega bands, Compression -> Explosion detector
# - Regime detection, OB/OS arrows, AddLabel & Chart Bubbles
# - ADEODATUS/ANTWERKS/AIChatGPT/Merged Build
# ================================================================

declare lower;

# ---------------------------
# USER INPUTS
# ---------------------------
input scoreLookback = 50;
input gammaLen = 3;
input vegaBBLength = 20;
input vegaNumSD = 2.0;

# OB/OS thresholds for Alpha (0-1 scale)
input obThreshold = 0.80;
input osThreshold = 0.20;
input showObOsArrows = yes;

# Regime detection
input regimeLen = 20;                   # smoothing for regime MA
input regimeTrendingThreshold = 0.55;   # alphaMA > -> trending
input regimeMeanRevThreshold = 0.45;    # alphaMA < -> mean-revert

# Compression / explosion detection
input compressionLookback = 20;         # measure average bandwidth
input compressionFactor = 0.45;         # compressed if width < factor * avgWidth
input explosionExpFactor = 1.8;         # explosion when width > factor * avgWidth
input explosionMinAlphaSpike = 0.12;    # minimum alpha jump to consider "spike"
input compressionMemoryBars = 6;        # require compression within last N bars

# Visual options
input showVegaCloud = yes;
input showAlphaLine = yes;
input showBubbles = yes;

# Bubble/arrow offsets
input arrowOffset = 0.06;

# ---------------------------
# PRICE & BASES
# ---------------------------
def H = high;
def L = low;
def C = close;
def V = volume;

def validRange = if H - L == 0 then 0.000001 else H - L;

# ---------------------------
# DELTA PROXY (raw + scaled 0-1)
# ---------------------------
def BuyingProxy  = V * (C - L) / validRange;
def SellingProxy = V * (H - C) / validRange;
def DeltaBarProxy = BuyingProxy - SellingProxy;

def safeCumLen = if scoreLookback * 2 < 1 then 1 else scoreLookback * 2;
def CumDeltaProxy = Sum(DeltaBarProxy, safeCumLen);

def deltaHiVal = Highest(CumDeltaProxy, scoreLookback);
def deltaLoVal = Lowest(CumDeltaProxy, scoreLookback);

def sDeltaVal = if deltaHiVal - deltaLoVal == 0 then 0 else (CumDeltaProxy - deltaLoVal) / (deltaHiVal - deltaLoVal);

# ---------------------------
# THETA PROXY (raw + scaled 0-1)
# ---------------------------
def tickChange = AbsValue(C - C[1]);
def sThetaRawVal = ExpAverage(tickChange, gammaLen);

def thetaHiVal = Highest(sThetaRawVal, scoreLookback);
def thetaLoVal = Lowest(sThetaRawVal, scoreLookback);
def sThetaVal = if thetaHiVal - thetaLoVal == 0 then 0 else (sThetaRawVal - thetaLoVal) / (thetaHiVal - thetaLoVal);

# ---------------------------
# FOLD / POWER BLEND -> ALPHA
# ---------------------------
def foldComponent = (sDeltaVal + sThetaVal) / 2;
def powerComponent = sDeltaVal * sThetaVal;
def alphaCoreVal = (foldComponent + powerComponent) / 2;
def alphaSmoothedVal = ExpAverage(alphaCoreVal, gammaLen);

# ---------------------------
# VEGA BANDS & WIDTH
# ---------------------------
def vegaBasisVal = Average(sThetaRawVal, vegaBBLength);
def vegaDevVal = StDev(sThetaRawVal, vegaBBLength);
def vegaUpperBandVal = vegaBasisVal + vegaNumSD * vegaDevVal;
def vegaLowerBandVal = vegaBasisVal - vegaNumSD * vegaDevVal;

def vegaWidthVal = vegaUpperBandVal - vegaLowerBandVal;
def avgVegaWidthVal = Average(vegaWidthVal, compressionLookback);

# ---------------------------
# COMPRESSION & EXPLOSION LOGIC
# ---------------------------
def isCompressedNowVal = vegaWidthVal < compressionFactor * avgVegaWidthVal;
def compressedRecentVal = Highest(if isCompressedNowVal then 1 else 0, compressionMemoryBars) > 0;

def widthIsExpandedVal = vegaWidthVal > explosionExpFactor * avgVegaWidthVal;

def alphaSpikeVal = alphaSmoothedVal - alphaSmoothedVal[1];
def alphaSpikeLargeVal = alphaSpikeVal > explosionMinAlphaSpike;

def explosionUpVal = compressedRecentVal and widthIsExpandedVal and alphaSpikeLargeVal and alphaSmoothedVal > alphaSmoothedVal[1];
def explosionDownVal = compressedRecentVal and widthIsExpandedVal and alphaSpikeLargeVal and alphaSmoothedVal < alphaSmoothedVal[1];

# ---------------------------
# REGIME DETECTION
# ---------------------------
def alphaMAVal = Average(alphaSmoothedVal, regimeLen);
def isTrendingVal = alphaMAVal > regimeTrendingThreshold;
def isMeanReversionVal = alphaMAVal < regimeMeanRevThreshold;
def isNeutralVal = !isTrendingVal and !isMeanReversionVal;

# ---------------------------
# OB / OS FLAGS
# ---------------------------
def isOBVal = alphaSmoothedVal >= obThreshold;
def isOSVal = alphaSmoothedVal <= osThreshold;

# ---------------------------
# CHART BUBBLE TRIGGERS (rising/falling crosses)
# ---------------------------
def alphaCrossUp70 = alphaSmoothedVal > 0.70 and alphaSmoothedVal[1] <= 0.70;
def alphaCrossUp55 = alphaSmoothedVal > 0.55 and alphaSmoothedVal[1] <= 0.55;
def alphaCrossDown30 = alphaSmoothedVal < 0.30 and alphaSmoothedVal[1] >= 0.30;
def alphaCrossDown45 = alphaSmoothedVal < 0.45 and alphaSmoothedVal[1] >= 0.45;

def bullRegimeStart = isTrendingVal and !isTrendingVal[1];
def bearRegimeStart = isMeanReversionVal and !isMeanReversionVal[1];
def chopRegimeStart = isNeutralVal and !isNeutralVal[1];

def compressionStart = isCompressedNowVal and !isCompressedNowVal[1];
def expansionStart = widthIsExpandedVal and !widthIsExpandedVal[1];

# ---------------------------
# ALL DEFS END — PLOTS & LABELS START
# ---------------------------
# Plots (use unique plot names)
plot AlphaPlot = if showAlphaLine then alphaSmoothedVal else Double.NaN;
AlphaPlot.SetDefaultColor(Color.CYAN);
AlphaPlot.SetLineWeight(2);

plot DeltaPlot = sDeltaVal;
DeltaPlot.SetDefaultColor(Color.YELLOW);
DeltaPlot.SetLineWeight(1);

plot ThetaPlot = sThetaVal;
ThetaPlot.SetDefaultColor(Color.MAGENTA);
ThetaPlot.SetLineWeight(1);

plot VegaUpperPlot = if showVegaCloud then vegaUpperBandVal else Double.NaN;
VegaUpperPlot.SetDefaultColor(Color.DARK_GRAY);
VegaUpperPlot.SetStyle(Curve.SHORT_DASH);

plot VegaLowerPlot = if showVegaCloud then vegaLowerBandVal else Double.NaN;
VegaLowerPlot.SetDefaultColor(Color.DARK_GRAY);
VegaLowerPlot.SetStyle(Curve.SHORT_DASH);

# Vega cloud
AddCloud(VegaUpperPlot, VegaLowerPlot, Color.LIGHT_GRAY, Color.DARK_GRAY);

# Zero baseline
plot ZeroBaseline = 0;
ZeroBaseline.SetDefaultColor(Color.DARK_GRAY);
ZeroBaseline.SetStyle(Curve.SHORT_DASH);

# OB / OS arrows (placed relative to alpha)
plot OBArrowPlot = if showObOsArrows and isOBVal then alphaSmoothedVal + arrowOffset else Double.NaN;
OBArrowPlot.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
OBArrowPlot.SetDefaultColor(Color.RED);
OBArrowPlot.SetLineWeight(2);

plot OSArrowPlot = if showObOsArrows and isOSVal then alphaSmoothedVal - arrowOffset else Double.NaN;
OSArrowPlot.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
OSArrowPlot.SetDefaultColor(Color.GREEN);
OSArrowPlot.SetLineWeight(2);

# Compression dot at vega basis
plot CompressionDotPlot = if isCompressedNowVal then vegaBasisVal else Double.NaN;
CompressionDotPlot.SetPaintingStrategy(PaintingStrategy.POINTS);
CompressionDotPlot.SetDefaultColor(Color.ORANGE);
CompressionDotPlot.SetLineWeight(3);

# Explosion arrows
plot ExplosionUpPlot = if explosionUpVal then alphaSmoothedVal + arrowOffset else Double.NaN;
ExplosionUpPlot.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
ExplosionUpPlot.SetDefaultColor(Color.GREEN);
ExplosionUpPlot.SetLineWeight(3);

plot ExplosionDownPlot = if explosionDownVal then alphaSmoothedVal - arrowOffset else Double.NaN;
ExplosionDownPlot.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
ExplosionDownPlot.SetDefaultColor(Color.RED);
ExplosionDownPlot.SetLineWeight(3);

# Fill background according to regime — use clouds to tint pane
# We create two transient plots for clouds (1 or NaN)
plot RegimeTrendTop = if isTrendingVal then 1 else Double.NaN;
plot RegimeTrendBottom = if isTrendingVal then 0 else Double.NaN;
plot RegimeMeanTop = if isMeanReversionVal then 1 else Double.NaN;
plot RegimeMeanBottom = if isMeanReversionVal then 0 else Double.NaN;

AddCloud(RegimeTrendTop, RegimeTrendBottom, Color.DARK_GREEN, Color.DARK_GREEN);
AddCloud(RegimeMeanTop, RegimeMeanBottom, Color.DARK_RED, Color.DARK_RED);

# Pane AddLabel for Alpha guidance (uses alphaSmoothedVal)
AddLabel(yes,
    if alphaSmoothedVal >= 0.70 then "VERY STRONG BULLISH FLOW – GO LONG / ADD"
    else if alphaSmoothedVal >= 0.55 then "BULLISH BIAS – GOOD LONG SETUP"
    else if alphaSmoothedVal >= 0.45 then "CHOP / WAIT – NO CLEAR EDGE"
    else if alphaSmoothedVal >= 0.30 then "BEARISH / CAUTION – DISTRIBUTION"
    else "HEAVY DISTRIBUTION – SHORT OR STAND ASIDE",
    if alphaSmoothedVal >= 0.70 then Color.UPTICK
    else if alphaSmoothedVal >= 0.55 then Color.GREEN
    else if alphaSmoothedVal <= 0.30 then Color.MAGENTA
    else if alphaSmoothedVal <= 0.45 then Color.RED
    else Color.GRAY
);

# Small additional label for compression/explosion state
AddLabel(yes,
    if explosionUpVal then "Explosion: UP"
    else if explosionDownVal then "Explosion: DOWN"
    else if compressedRecentVal then "Compression: Recent"
    else "Compression: None",
    if explosionUpVal then Color.GREEN else if explosionDownVal then Color.RED else if compressedRecentVal then Color.ORANGE else Color.GRAY
);

# Chart bubbles (on bar)
# Alpha OB/OS bubbles
AddChartBubble(showBubbles and alphaCrossUp70, low, "STRONG BUY", Color.UPTICK, no);
AddChartBubble(showBubbles and alphaCrossUp55, low, "BULL", Color.GREEN, no);
AddChartBubble(showBubbles and alphaCrossDown30, high, "STRONG SELL", Color.MAGENTA, yes);
AddChartBubble(showBubbles and alphaCrossDown45, high, "BEAR", Color.RED, yes);

# Regime start bubbles
AddChartBubble(showBubbles and bullRegimeStart, low, "BULL REGIME", Color.GREEN, no);
AddChartBubble(showBubbles and bearRegimeStart, high, "BEAR REGIME", Color.RED, yes);
AddChartBubble(showBubbles and chopRegimeStart, low, "CHOP", Color.GRAY, no);

# Compression / explosion bubbles
AddChartBubble(showBubbles and compressionStart, low, "COMPRESSION", Color.YELLOW, no);
AddChartBubble(showBubbles and expansionStart and explosionUpVal, low, "EXPLOSION UP", Color.CYAN, no);
AddChartBubble(showBubbles and expansionStart and explosionDownVal, high, "EXPLOSION DOWN", Color.MAGENTA, yes);

# Cleanup: hide plot bubbles for plotting clutter
AlphaPlot.HideBubble();
DeltaPlot.HideBubble();
ThetaPlot.HideBubble();
VegaUpperPlot.HideBubble();
VegaLowerPlot.HideBubble();
CompressionDotPlot.HideBubble();
OBArrowPlot.HideBubble();
OSArrowPlot.HideBubble();
ExplosionUpPlot.HideBubble();
ExplosionDownPlot.HideBubble();

# End of script
 
Code:
# ================================================================
# FOLD–POWER ALPHA ENGINE — MERGED PRO (compiled, visuals, bubbles)
# - Delta proxy, Theta proxy, Fold/Power blending
# - Vega bands, Compression -> Explosion detector
# - Regime detection, OB/OS arrows, AddLabel & Chart Bubbles
# - ADEODATUS/ANTWERKS/AIChatGPT/Merged Build
# ================================================================

declare lower;

# ---------------------------
# USER INPUTS
# ---------------------------
input scoreLookback = 50;
input gammaLen = 3;
input vegaBBLength = 20;
input vegaNumSD = 2.0;

# OB/OS thresholds for Alpha (0-1 scale)
input obThreshold = 0.80;
input osThreshold = 0.20;
input showObOsArrows = yes;

# Regime detection
input regimeLen = 20;                   # smoothing for regime MA
input regimeTrendingThreshold = 0.55;   # alphaMA > -> trending
input regimeMeanRevThreshold = 0.45;    # alphaMA < -> mean-revert

# Compression / explosion detection
input compressionLookback = 20;         # measure average bandwidth
input compressionFactor = 0.45;         # compressed if width < factor * avgWidth
input explosionExpFactor = 1.8;         # explosion when width > factor * avgWidth
input explosionMinAlphaSpike = 0.12;    # minimum alpha jump to consider "spike"
input compressionMemoryBars = 6;        # require compression within last N bars

# Visual options
input showVegaCloud = yes;
input showAlphaLine = yes;
input showBubbles = yes;

# Bubble/arrow offsets
input arrowOffset = 0.06;

# ---------------------------
# PRICE & BASES
# ---------------------------
def H = high;
def L = low;
def C = close;
def V = volume;

def validRange = if H - L == 0 then 0.000001 else H - L;

# ---------------------------
# DELTA PROXY (raw + scaled 0-1)
# ---------------------------
def BuyingProxy  = V * (C - L) / validRange;
def SellingProxy = V * (H - C) / validRange;
def DeltaBarProxy = BuyingProxy - SellingProxy;

def safeCumLen = if scoreLookback * 2 < 1 then 1 else scoreLookback * 2;
def CumDeltaProxy = Sum(DeltaBarProxy, safeCumLen);

def deltaHiVal = Highest(CumDeltaProxy, scoreLookback);
def deltaLoVal = Lowest(CumDeltaProxy, scoreLookback);

def sDeltaVal = if deltaHiVal - deltaLoVal == 0 then 0 else (CumDeltaProxy - deltaLoVal) / (deltaHiVal - deltaLoVal);

# ---------------------------
# THETA PROXY (raw + scaled 0-1)
# ---------------------------
def tickChange = AbsValue(C - C[1]);
def sThetaRawVal = ExpAverage(tickChange, gammaLen);

def thetaHiVal = Highest(sThetaRawVal, scoreLookback);
def thetaLoVal = Lowest(sThetaRawVal, scoreLookback);
def sThetaVal = if thetaHiVal - thetaLoVal == 0 then 0 else (sThetaRawVal - thetaLoVal) / (thetaHiVal - thetaLoVal);

# ---------------------------
# FOLD / POWER BLEND -> ALPHA
# ---------------------------
def foldComponent = (sDeltaVal + sThetaVal) / 2;
def powerComponent = sDeltaVal * sThetaVal;
def alphaCoreVal = (foldComponent + powerComponent) / 2;
def alphaSmoothedVal = ExpAverage(alphaCoreVal, gammaLen);

# ---------------------------
# VEGA BANDS & WIDTH
# ---------------------------
def vegaBasisVal = Average(sThetaRawVal, vegaBBLength);
def vegaDevVal = StDev(sThetaRawVal, vegaBBLength);
def vegaUpperBandVal = vegaBasisVal + vegaNumSD * vegaDevVal;
def vegaLowerBandVal = vegaBasisVal - vegaNumSD * vegaDevVal;

def vegaWidthVal = vegaUpperBandVal - vegaLowerBandVal;
def avgVegaWidthVal = Average(vegaWidthVal, compressionLookback);

# ---------------------------
# COMPRESSION & EXPLOSION LOGIC
# ---------------------------
def isCompressedNowVal = vegaWidthVal < compressionFactor * avgVegaWidthVal;
def compressedRecentVal = Highest(if isCompressedNowVal then 1 else 0, compressionMemoryBars) > 0;

def widthIsExpandedVal = vegaWidthVal > explosionExpFactor * avgVegaWidthVal;

def alphaSpikeVal = alphaSmoothedVal - alphaSmoothedVal[1];
def alphaSpikeLargeVal = alphaSpikeVal > explosionMinAlphaSpike;

def explosionUpVal = compressedRecentVal and widthIsExpandedVal and alphaSpikeLargeVal and alphaSmoothedVal > alphaSmoothedVal[1];
def explosionDownVal = compressedRecentVal and widthIsExpandedVal and alphaSpikeLargeVal and alphaSmoothedVal < alphaSmoothedVal[1];

# ---------------------------
# REGIME DETECTION
# ---------------------------
def alphaMAVal = Average(alphaSmoothedVal, regimeLen);
def isTrendingVal = alphaMAVal > regimeTrendingThreshold;
def isMeanReversionVal = alphaMAVal < regimeMeanRevThreshold;
def isNeutralVal = !isTrendingVal and !isMeanReversionVal;

# ---------------------------
# OB / OS FLAGS
# ---------------------------
def isOBVal = alphaSmoothedVal >= obThreshold;
def isOSVal = alphaSmoothedVal <= osThreshold;

# ---------------------------
# CHART BUBBLE TRIGGERS (rising/falling crosses)
# ---------------------------
def alphaCrossUp70 = alphaSmoothedVal > 0.70 and alphaSmoothedVal[1] <= 0.70;
def alphaCrossUp55 = alphaSmoothedVal > 0.55 and alphaSmoothedVal[1] <= 0.55;
def alphaCrossDown30 = alphaSmoothedVal < 0.30 and alphaSmoothedVal[1] >= 0.30;
def alphaCrossDown45 = alphaSmoothedVal < 0.45 and alphaSmoothedVal[1] >= 0.45;

def bullRegimeStart = isTrendingVal and !isTrendingVal[1];
def bearRegimeStart = isMeanReversionVal and !isMeanReversionVal[1];
def chopRegimeStart = isNeutralVal and !isNeutralVal[1];

def compressionStart = isCompressedNowVal and !isCompressedNowVal[1];
def expansionStart = widthIsExpandedVal and !widthIsExpandedVal[1];

# ---------------------------
# ALL DEFS END — PLOTS & LABELS START
# ---------------------------
# Plots (use unique plot names)
plot AlphaPlot = if showAlphaLine then alphaSmoothedVal else Double.NaN;
AlphaPlot.SetDefaultColor(Color.CYAN);
AlphaPlot.SetLineWeight(2);

plot DeltaPlot = sDeltaVal;
DeltaPlot.SetDefaultColor(Color.YELLOW);
DeltaPlot.SetLineWeight(1);

plot ThetaPlot = sThetaVal;
ThetaPlot.SetDefaultColor(Color.MAGENTA);
ThetaPlot.SetLineWeight(1);

plot VegaUpperPlot = if showVegaCloud then vegaUpperBandVal else Double.NaN;
VegaUpperPlot.SetDefaultColor(Color.DARK_GRAY);
VegaUpperPlot.SetStyle(Curve.SHORT_DASH);

plot VegaLowerPlot = if showVegaCloud then vegaLowerBandVal else Double.NaN;
VegaLowerPlot.SetDefaultColor(Color.DARK_GRAY);
VegaLowerPlot.SetStyle(Curve.SHORT_DASH);

# Vega cloud
AddCloud(VegaUpperPlot, VegaLowerPlot, Color.LIGHT_GRAY, Color.DARK_GRAY);

# Zero baseline
plot ZeroBaseline = 0;
ZeroBaseline.SetDefaultColor(Color.DARK_GRAY);
ZeroBaseline.SetStyle(Curve.SHORT_DASH);

# OB / OS arrows (placed relative to alpha)
plot OBArrowPlot = if showObOsArrows and isOBVal then alphaSmoothedVal + arrowOffset else Double.NaN;
OBArrowPlot.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
OBArrowPlot.SetDefaultColor(Color.RED);
OBArrowPlot.SetLineWeight(2);

plot OSArrowPlot = if showObOsArrows and isOSVal then alphaSmoothedVal - arrowOffset else Double.NaN;
OSArrowPlot.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
OSArrowPlot.SetDefaultColor(Color.GREEN);
OSArrowPlot.SetLineWeight(2);

# Compression dot at vega basis
plot CompressionDotPlot = if isCompressedNowVal then vegaBasisVal else Double.NaN;
CompressionDotPlot.SetPaintingStrategy(PaintingStrategy.POINTS);
CompressionDotPlot.SetDefaultColor(Color.ORANGE);
CompressionDotPlot.SetLineWeight(3);

# Explosion arrows
plot ExplosionUpPlot = if explosionUpVal then alphaSmoothedVal + arrowOffset else Double.NaN;
ExplosionUpPlot.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
ExplosionUpPlot.SetDefaultColor(Color.GREEN);
ExplosionUpPlot.SetLineWeight(3);

plot ExplosionDownPlot = if explosionDownVal then alphaSmoothedVal - arrowOffset else Double.NaN;
ExplosionDownPlot.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
ExplosionDownPlot.SetDefaultColor(Color.RED);
ExplosionDownPlot.SetLineWeight(3);

# Fill background according to regime — use clouds to tint pane
# We create two transient plots for clouds (1 or NaN)
plot RegimeTrendTop = if isTrendingVal then 1 else Double.NaN;
plot RegimeTrendBottom = if isTrendingVal then 0 else Double.NaN;
plot RegimeMeanTop = if isMeanReversionVal then 1 else Double.NaN;
plot RegimeMeanBottom = if isMeanReversionVal then 0 else Double.NaN;

AddCloud(RegimeTrendTop, RegimeTrendBottom, Color.DARK_GREEN, Color.DARK_GREEN);
AddCloud(RegimeMeanTop, RegimeMeanBottom, Color.DARK_RED, Color.DARK_RED);

# Pane AddLabel for Alpha guidance (uses alphaSmoothedVal)
AddLabel(yes,
    if alphaSmoothedVal >= 0.70 then "VERY STRONG BULLISH FLOW – GO LONG / ADD"
    else if alphaSmoothedVal >= 0.55 then "BULLISH BIAS – GOOD LONG SETUP"
    else if alphaSmoothedVal >= 0.45 then "CHOP / WAIT – NO CLEAR EDGE"
    else if alphaSmoothedVal >= 0.30 then "BEARISH / CAUTION – DISTRIBUTION"
    else "HEAVY DISTRIBUTION – SHORT OR STAND ASIDE",
    if alphaSmoothedVal >= 0.70 then Color.UPTICK
    else if alphaSmoothedVal >= 0.55 then Color.GREEN
    else if alphaSmoothedVal <= 0.30 then Color.MAGENTA
    else if alphaSmoothedVal <= 0.45 then Color.RED
    else Color.GRAY
);

# Small additional label for compression/explosion state
AddLabel(yes,
    if explosionUpVal then "Explosion: UP"
    else if explosionDownVal then "Explosion: DOWN"
    else if compressedRecentVal then "Compression: Recent"
    else "Compression: None",
    if explosionUpVal then Color.GREEN else if explosionDownVal then Color.RED else if compressedRecentVal then Color.ORANGE else Color.GRAY
);

# Chart bubbles (on bar)
# Alpha OB/OS bubbles
AddChartBubble(showBubbles and alphaCrossUp70, low, "STRONG BUY", Color.UPTICK, no);
AddChartBubble(showBubbles and alphaCrossUp55, low, "BULL", Color.GREEN, no);
AddChartBubble(showBubbles and alphaCrossDown30, high, "STRONG SELL", Color.MAGENTA, yes);
AddChartBubble(showBubbles and alphaCrossDown45, high, "BEAR", Color.RED, yes);

# Regime start bubbles
AddChartBubble(showBubbles and bullRegimeStart, low, "BULL REGIME", Color.GREEN, no);
AddChartBubble(showBubbles and bearRegimeStart, high, "BEAR REGIME", Color.RED, yes);
AddChartBubble(showBubbles and chopRegimeStart, low, "CHOP", Color.GRAY, no);

# Compression / explosion bubbles
AddChartBubble(showBubbles and compressionStart, low, "COMPRESSION", Color.YELLOW, no);
AddChartBubble(showBubbles and expansionStart and explosionUpVal, low, "EXPLOSION UP", Color.CYAN, no);
AddChartBubble(showBubbles and expansionStart and explosionDownVal, high, "EXPLOSION DOWN", Color.MAGENTA, yes);

# Cleanup: hide plot bubbles for plotting clutter
AlphaPlot.HideBubble();
DeltaPlot.HideBubble();
ThetaPlot.HideBubble();
VegaUpperPlot.HideBubble();
VegaLowerPlot.HideBubble();
CompressionDotPlot.HideBubble();
OBArrowPlot.HideBubble();
OSArrowPlot.HideBubble();
ExplosionUpPlot.HideBubble();
ExplosionDownPlot.HideBubble();

# End of script
2025-11-25-TOS_CHARTSXOM3.png

Lower chart Werks
 
ADJUST WITH AN INPUT DISTANCE FOR BUBBLES
Code:
# ================================================================
# FOLD–POWER ALPHA ENGINE — MERGED PRO
# Now with fully adjustable bubble & arrow offset from Alpha line
#ADEODATUS/ANTWERKS ================================================================
declare lower;

# ---------------------------
# USER INPUTS
# ---------------------------
input scoreLookback             = 50;
input gammaLen                  = 3;
input vegaBBLength              = 20;
input vegaNumSD                 = 2.0;
input obThreshold               = 0.80;
input osThreshold               = 0.20;
input showObOsArrows            = yes;
input regimeLen                 = 20;
input regimeTrendingThreshold   = 0.55;
input regimeMeanRevThreshold    = 0.45;
input compressionLookback       = 20;
input compressionFactor         = 0.45;
input explosionExpFactor        = 1.8;
input explosionMinAlphaSpike    = 0.12;
input compressionMemoryBars     = 6;
input showVegaCloud             = yes;
input showAlphaLine             = yes;
input showBubbles               = yes;

# ───── NEW: MASTER OFFSET CONTROLS (this is what you wanted) ─────
input arrowOffset  = 0.08;   # Distance for arrows
input bubbleOffset = 0.12;   # Distance for ALL bubbles (adjust live!)

# ---------------------------
# PRICE & BASES
# ---------------------------
def H = high;
def L = low;
def C = close;
def V = volume;
def validRange = if H - L == 0 then 0.000001 else H - L;

# ---------------------------
# DELTA PROXY
# ---------------------------
def BuyingProxy  = V * (C - L) / validRange;
def SellingProxy = V * (H - C) / validRange;
def DeltaBarProxy = BuyingProxy - SellingProxy;
def safeCumLen = if scoreLookback * 2 < 1 then 1 else scoreLookback * 2;
def CumDeltaProxy = Sum(DeltaBarProxy, safeCumLen);
def deltaHiVal = Highest(CumDeltaProxy, scoreLookback);
def deltaLoVal = Lowest(CumDeltaProxy, scoreLookback);
def sDeltaVal = if deltaHiVal - deltaLoVal == 0 then 0 else (CumDeltaProxy - deltaLoVal) / (deltaHiVal - deltaLoVal);

# ---------------------------
# THETA PROXY
# ---------------------------
def tickChange = AbsValue(C - C[1]);
def sThetaRawVal = ExpAverage(tickChange, gammaLen);
def thetaHiVal = Highest(sThetaRawVal, scoreLookback);
def thetaLoVal = Lowest(sThetaRawVal, scoreLookback);
def sThetaVal = if thetaHiVal - thetaLoVal == 0 then 0 else (sThetaRawVal - thetaLoVal) / (thetaHiVal - thetaLoVal);

# ---------------------------
# ALPHA CORE + SMOOTHED
# ---------------------------
def foldComponent     = (sDeltaVal + sThetaVal) / 2;
def powerComponent    = sDeltaVal * sThetaVal;
def alphaCoreVal      = (foldComponent + powerComponent) / 2;
def alphaSmoothedVal  = ExpAverage(alphaCoreVal, gammaLen);
def alphaSmoothPlot   = ExpAverage(alphaSmoothedVal, 3);  # extra smooth for bubbles/arrows

# ---------------------------
# VEGA BANDS & COMPRESSION/EXPLOSION
# ---------------------------
def vegaBasisVal = Average(sThetaRawVal, vegaBBLength);
def vegaDevVal   = StDev(sThetaRawVal, vegaBBLength);
def vegaUpperBandVal = vegaBasisVal + vegaNumSD * vegaDevVal;
def vegaLowerBandVal = vegaBasisVal - vegaNumSD * vegaDevVal;
def vegaWidthVal = vegaUpperBandVal - vegaLowerBandVal;
def avgVegaWidthVal = Average(vegaWidthVal, compressionLookback);

def isCompressedNowVal = vegaWidthVal < compressionFactor * avgVegaWidthVal;
def compressedRecentVal = Highest(if isCompressedNowVal then 1 else 0, compressionMemoryBars) > 0;
def widthIsExpandedVal  = vegaWidthVal > explosionExpFactor * avgVegaWidthVal;
def alphaSpikeVal = alphaSmoothedVal - alphaSmoothedVal[1];
def alphaSpikeLargeVal = AbsValue(alphaSpikeVal) > explosionMinAlphaSpike;
def explosionUpVal   = compressedRecentVal and widthIsExpandedVal and alphaSpikeLargeVal and alphaSmoothedVal > alphaSmoothedVal[1];
def explosionDownVal = compressedRecentVal and widthIsExpandedVal and alphaSpikeLargeVal and alphaSmoothedVal < alphaSmoothedVal[1];

# ---------------------------
# REGIME DETECTION
# ---------------------------
def alphaMAVal = Average(alphaSmoothedVal, regimeLen);
def isTrendingVal      = alphaMAVal > regimeTrendingThreshold;
def isMeanReversionVal = alphaMAVal < regimeMeanRevThreshold;
def isNeutralVal       = !isTrendingVal and !isMeanReversionVal;

# ---------------------------
# OB / OS FLAGS
# ---------------------------
def isOBVal = alphaSmoothedVal >= obThreshold;
def isOSVal = alphaSmoothedVal <= osThreshold;

# ---------------------------
# BUBBLE & ARROW TRIGGERS
# ---------------------------
def alphaCrossUp70    = alphaSmoothedVal > 0.70 and alphaSmoothedVal[1] <= 0.70;
def alphaCrossUp55    = alphaSmoothedVal > 0.55 and alphaSmoothedVal[1] <= 0.55;
def alphaCrossDown30  = alphaSmoothedVal < 0.30 and alphaSmoothedVal[1] >= 0.30;
def alphaCrossDown45  = alphaSmoothedVal < 0.45 and alphaSmoothedVal[1] >= 0.45;
def bullRegimeStart   = isTrendingVal and !isTrendingVal[1];
def bearRegimeStart   = isMeanReversionVal and !isMeanReversionVal[1];
def chopRegimeStart   = isNeutralVal and !isNeutralVal[1];
def compressionStart  = isCompressedNowVal and !isCompressedNowVal[1];
def expansionStart    = widthIsExpandedVal and !widthIsExpandedVal[1];

# ================================================================
# PLOTS
# ================================================================
plot AlphaPlot = if showAlphaLine then alphaSmoothedVal else Double.NaN;
AlphaPlot.SetDefaultColor(Color.CYAN);
AlphaPlot.SetLineWeight(3);

plot ZeroBaseline = 0;
ZeroBaseline.SetDefaultColor(Color.DARK_GRAY);
ZeroBaseline.SetStyle(Curve.SHORT_DASH);

# Vega cloud
plot VegaUpperPlot = if showVegaCloud then vegaUpperBandVal else Double.NaN;
plot VegaLowerPlot = if showVegaCloud then vegaLowerBandVal else Double.NaN;
VegaUpperPlot.SetDefaultColor(Color.DARK_GRAY);
VegaLowerPlot.SetDefaultColor(Color.DARK_GRAY);
AddCloud(VegaUpperPlot, VegaLowerPlot, Color.LIGHT_GRAY, Color.DARK_GRAY);

# OB/OS Arrows — perfectly offset
plot OBArrowPlot = if showObOsArrows and isOBVal then alphaSmoothPlot + arrowOffset else Double.NaN;
OBArrowPlot.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
OBArrowPlot.SetDefaultColor(Color.RED);
OBArrowPlot.SetLineWeight(4);

plot OSArrowPlot = if showObOsArrows and isOSVal then alphaSmoothPlot - arrowOffset else Double.NaN;
OSArrowPlot.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
OSArrowPlot.SetDefaultColor(Color.CYAN);
OSArrowPlot.SetLineWeight(4);

# Explosion arrows
plot ExplosionUpPlot = if explosionUpVal then alphaSmoothPlot + arrowOffset else Double.NaN;
ExplosionUpPlot.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
ExplosionUpPlot.SetDefaultColor(Color.LIME);
ExplosionUpPlot.SetLineWeight(5);

plot ExplosionDownPlot = if explosionDownVal then alphaSmoothPlot - arrowOffset else Double.NaN;
ExplosionDownPlot.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
ExplosionDownPlot.SetDefaultColor(Color.MAGENTA);
ExplosionDownPlot.SetLineWeight(5);

# Regime background tint
plot TrendTop = if isTrendingVal then 1 else Double.NaN;
plot TrendBot = if isTrendingVal then 0 else Double.NaN;
plot MeanTop  = if isMeanReversionVal then 1 else Double.NaN;
plot MeanBot  = if isMeanReversionVal then 0 else Double.NaN;
AddCloud(TrendTop, TrendBot, Color.DARK_GREEN, Color.DARK_GREEN);
AddCloud(MeanTop,  MeanBot,  Color.DARK_RED,   Color.DARK_RED);

# ================================================================
# PROFESSIONAL BUBBLES — ALL OFFSET FROM ALPHA LINE
# ================================================================
AddChartBubble(showBubbles && alphaCrossUp70,
    alphaSmoothPlot + bubbleOffset, "STRONG BUY", Color.UPTICK, yes);

AddChartBubble(showBubbles && alphaCrossUp55 && !alphaCrossUp70,
    alphaSmoothPlot + bubbleOffset, "BULL", Color.GREEN, yes);

AddChartBubble(showBubbles && alphaCrossDown30,
    alphaSmoothPlot - bubbleOffset, "STRONG SELL", Color.MAGENTA, no);

AddChartBubble(showBubbles && alphaCrossDown45 && !alphaCrossDown30,
    alphaSmoothPlot - bubbleOffset, "BEAR", Color.RED, no);

AddChartBubble(showBubbles && bullRegimeStart,
    alphaSmoothPlot + bubbleOffset, "BULL REGIME", Color.CYAN, yes);

AddChartBubble(showBubbles && bearRegimeStart,
    alphaSmoothPlot - bubbleOffset, "BEAR REGIME", Color.ORANGE, no);

AddChartBubble(showBubbles && chopRegimeStart,
    alphaSmoothPlot, "CHOP", Color.GRAY, yes);

AddChartBubble(showBubbles && compressionStart,
    alphaSmoothPlot, "COMPRESSION", Color.YELLOW, yes);

AddChartBubble(showBubbles && explosionUpVal,
    alphaSmoothPlot + bubbleOffset, "EXPLOSION UP", Color.CYAN, yes);

AddChartBubble(showBubbles && explosionDownVal,
    alphaSmoothPlot - bubbleOffset, "EXPLOSION DOWN", Color.MAGENTA, no);

# ================================================================
# LABELS
# ================================================================
AddLabel(yes,
    if alphaSmoothedVal >= 0.70 then "VERY STRONG BULLISH FLOW – GO LONG / ADD"
    else if alphaSmoothedVal >= 0.55 then "BULLISH BIAS – GOOD LONG SETUP"
    else if alphaSmoothedVal >= 0.45 then "CHOP / WAIT – NO CLEAR EDGE"
    else if alphaSmoothedVal >= 0.30 then "BEARISH / CAUTION – DISTRIBUTION"
    else "HEAVY DISTRIBUTION – SHORT OR STAND ASIDE",
    if alphaSmoothedVal >= 0.70 then Color.UPTICK
    else if alphaSmoothedVal >= 0.55 then Color.GREEN
    else if alphaSmoothedVal <= 0.30 then Color.MAGENTA
    else if alphaSmoothedVal <= 0.45 then Color.RED
    else Color.GRAY
);

AddLabel(yes, "Alpha: " + Round(alphaSmoothedVal, 3), Color.WHITE);

# Compression / Explosion status label (now correct)
AddLabel(explosionUpVal or explosionDownVal or compressedRecentVal,
    if explosionUpVal then "EXPLOSION UP"
    else if explosionDownVal then "EXPLOSION DOWN"
    else "COMPRESSION ACTIVE",
    if explosionUpVal then Color.LIME else Color.RED
);

# End of script — clean, professional, and fully adjustable

1764099253945.png
 
Say ANTWERKS, it works quite well! Positively intense, manageable and some insight to moves up and down. Nice? Better than that. Had to work to slow it a bit, read on 15 minute.

score look back: 20
gamma len: 14

OB threshold: 0.7
OS threshold: same

compression lookback 30
compression factor: 0.25

explosion exp factor 1.5
explosion minimum alpha spike: 0.12


2025-11-26-TOS_CHARTSA.png
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
1542 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top