blacknovember
New member
PRO EDGE v25.19 — QUANTUM TERMINAL (DOT DIVERGENCE EDITION)
IMBALANCE DIVERGENCE ENGINE + TREND ARMOR + FULL SATY FIBS
IMBALANCE DIVERGENCE ENGINE + TREND ARMOR + FULL SATY FIBS
1. Big Picture: What This Study Does
- Combines multiple engines into one:
- Intraday EMA/Ripster clouds (micro trend/structure).
- Higher-timeframe EMA context (H1, H4, D, W bias).
- KAMA “Quantum Ribbon” (adaptive trend filter).
- Volume imbalance + ignition logic (who’s actually in control).
- Trend Armor scoring (A+, A, A-, B+ execution bubbles).
- Imbalance-based divergence dots (bullish/bearish).
- Volatility-based SATY fib targets (.382/.5/.618/.786/1.0).
- Dynamic supply/demand zones from ignition bars.
- Golden-pocket reload zones once trend is locked.
- MTF ATR-based projections (1H / 4H / D).
- Think of it as:
- Top row: labels → regime, score, imbalance, key levels (PDH/PDL/PWH/PWL).
- Middle: clouds, KAMA, price color → directional bias + structure.
- Overlays: dots, bubbles, S/D boxes, fibs, projections → timing + location.
2. Core Workflow (How To Read It)
When a new setup shows up, process it in this order:
- Regime first
- Check SYS label:
- “SQUEEZE” → expect mean reversion, fakeouts, fade edges, be picky.
- “BULL TREND” / “BEAR TREND” → favor continuation and pullback entries.
- Confirm with:
- Price color (cyan vs magenta).
- KAMA ribbon side (close ≥ KAMA = bull, < KAMA = bear).
- IsChop flag internally (you’ll feel it via gray price bars and labels).
- Check SYS label:
- Direction & strength
- Look at:
- SCORE: xx/100 label → confluence/quality, not a certainty meter.
- Dominant side (bull vs bear score under the hood).
- A+/A/A-/B+ bubbles:
- Cyan under price → bullish execution windows.
- Magenta above price → bearish execution windows.
- Treat grades like:
- A+ / A → “prime candidates if location is good and regime agrees.”
- A- / B+ → “only with really clean location or extra confirmation.”
- Look at:
- Location
- Use labels:
- PDH / PDL / PWH / PWL on the label strip.
- Use lines/zones:
- Daily VWAP.
- Dynamic S/D boxes (dark magenta = supply, dark cyan = demand).
- Golden pocket reload zones (gold clouds at .618–.786 of the trend leg).
- SATY fib up/down bands from prior close (volatility-scaled).
- 1H / 4H / D projections (squares + bubbles “1H PROJ”, “4H PROJ”, “D PROJ”).
- If a signal fires in the middle of nowhere (no relevant level/zone), down-rank it.
- Use labels:
- Signal type (trend vs reversal)
- Trend/continuation:
- SYS in trend mode, price on right side of KAMA, supportive flow imbalance, and a pullback into:
- Reload pocket, VWAP, S/D, or prior HTF level, followed by an A+/A bubble.
- SYS in trend mode, price on right side of KAMA, supportive flow imbalance, and a pullback into:
- Reversion/flip:
- Regime = chop or stretched conditions:
- Z-score extremes, sweep of PDH/PDL, and/or divergence dots lining up with major levels or fib/projections.
- Regime = chop or stretched conditions:
- Trend/continuation:
- Targets & invalidation
- Targets:
- Fib bands (.382/.5/.618/.786/1.0 up/down).
- 1H / 4H / D projections.
- Opposite dynamic zone (e.g., from demand box to VWAP/PDH).
- Invalidation:
- Trend Armor level for your side (trailingLow3/trailingHigh3).
- Breaks of S/D box you’re trading off.
- Loss of KAMA side + score decay.
- Targets:
3. What To Look For (High-Quality Setups)
A. Bull Trend Play (continuation)
- Conditions:
- SYS = BULL TREND.
- Price above KAMA, KAMA colored cyan.
- Flow: trendImbalance > 0, buy-imbalance labels greenish.
- Trend Armor locked bull (TrendRider at trailing lows).
- Ideal entry zone:
- Pullback into:
- Bull golden pocket (gold cloud under price),
- Dynamic demand box (cyan S/D),
- Or daily VWAP, PDH/PDL, prior week levels in confluence.
- Then a fresh bullish A+/A (or at least A-) bubble prints.
- Pullback into:
- Management:
- Scale at fib up levels (.382 → .618 → 1.0) and 1H/4H projections.
- Consider tightening if bearish divergence dot appears into those targets.
- Mirror of bull:
- SYS = BEAR TREND.
- Price below KAMA, magenta ribbon.
- Flow: trendImbalance < 0, sell-imbalance labels magenta.
- Trend Armor locked bear (TrendRider at trailing highs).
- Ideal entry zone:
- Rally into:
- Bear golden pocket above price,
- Dynamic supply box (magenta S/D),
- VWAP / PDH / HTF highs.
- Then a bearish A+/A bubble at or near those zones.
- Rally into:
- Management:
- Targets at fib down levels + 1H/4H/D downside projections.
- Watch for bullish divergence at exhaustion levels to take profits.
- Conditions:
- SYS = SQUEEZE or clearly mixed HTF.
- isChop internally true, BB < KC style squeeze logic.
- Look for:
- Price sweeping PDH (then failing back inside) or PDL (wick then reclaim).
- Strong z-score extremes or ignition bars into fib/projection boundaries.
- Divergence dots:
- Green dot under a low → lower low in price, but better imbalance.
- Red dot over a high → higher high in price, but weaker imbalance.
- Plan:
- Fade away from extremes back toward VWAP / midrange.
- Short leash, quick partials, risk smaller than trend plays.
4. Divergence Dots: How To Treat Them
- Bullish divergence (green dot below bar):
- Swing low + lower low in price vs prior swing, but higher trendImbalance.
- Use as:
- Context for exhaustion,
- Early warning for covering shorts,
- Optional probe for reversal if location and regime fit.
- Bearish divergence (red dot above bar):
- Swing high + higher high in price vs prior swing, but lower trendImbalance.
- Use as:
- Context for late-stage extension,
- Signal to tighten longs, not instant “short now” by itself.
- Key rule:
- Dots ≠ auto-trade.
- Combine with:
- Level (PDH/PDL, fib/projection, S/D, VWAP),
- Score regime (trend vs chop),
- KAMA + Trend Armor state.
5. Trend Armor & Safety Filters
- Trend Armor (TrendRider line):
- In bull lock:
- Line tracks trailing 3-bar lows; price above = “safe long.”
- In bear lock:
- Line tracks trailing 3-bar highs; price below = “safe short.”
- In bull lock:
- Safety logic:
- Bull exec is suppressed if you’re in a “safe short” context.
- Bear exec is suppressed if you’re in a “safe long” context.
- Usage:
- Don’t fight the locked trend unless you’re explicitly running a reversion play off strong location + divergence.
- Use TrendRider as a hard stop zone, not necessarily the exact tick.
6. Good Habits (To Use It Effectively)
- Turn modules on/off with the inputs:
- If you’re biasing to pure price-action, disable some clouds and projections.
- If you’re focused on intraday scalps, maybe hide macro projections and leave KAMA + Trend Armor + VWAP + PDH/PDL.
- Only size up when:
- Regime, KAMA, flow, score, and location all agree.
- You’re not trading into a major HTF level against your direction.
- Treat the score as:
- A filter: “Is this worth my attention?” not “I’m guaranteed to win.”
- Keep the chart readable:
- Too many overlapping clouds/bubbles kill edge because you hesitate.
- Build a layout profile that matches your style (scalp, swing, etc.).
7. What NOT To Do
- Don’t:
- Buy every green dot or sell every red dot.
- Trade only off a single A+/A bubble with no regard for location.
- Ignore SYS regime; a breakout mentality in chop or fade mentality in strong trend will get punished.
- Double size just because the score is high; risk management still rules.
- Run all visual elements on very small screens and expect clarity.
- Also don’t:
- Use it as a black box.
- This is a framework for structured discretion – confluence and filtering; it’s not meant to replace a plan for entries, stops, scaling, and session limits.
If you want, I can write a short “cheat sheet” section you can pin under the post, like:
- “For longs, I want: X, Y, Z all true; avoid when A or B.”
- “For shorts, I want: …”
- “Flat/no-trade when: …”
http://tos.mx/!egl8fca4
Code:
# =====================================================================
# PRO EDGE v25.19 — QUANTUM TERMINAL (DOT DIVERGENCE EDITION)
# IMBALANCE DIVERGENCE ENGINE + TREND ARMOR + FULL SATY FIBS
# =====================================================================
declare upper;
# ─── MASTER TOGGLES ───
input show10mClouds = yes;
input showMacroClouds = yes;
input showMacroStrat = yes;
input showKAMARibbon = yes;
input showTrendArmor = yes;
input showImbDivergences = yes;
input showQuantumTargets = yes;
input showDynamicSD = yes;
input showReloadZones = yes;
input showMTFProjections = yes;
input showVwapMagnet = yes;
input enableAudioAlerts = yes;
# ─── ENGINE LOOKBACKS ───
input slopeLength = 200; input slopeLookback = 5;
def _TR = TrueRange(high, close, low);
def _ATR14 = Average(_TR, 14); def _ATR20 = Average(_TR, 20);
# ─── UNIFIED BINARY COLOR PALETTE ───
DefineGlobalColor("TermCyan", CreateColor(0, 255, 255));
DefineGlobalColor("TermMagenta", CreateColor(255, 0, 255));
DefineGlobalColor("TermNeonGreen", CreateColor(0, 255, 120));
DefineGlobalColor("TermWarning", CreateColor(255, 180, 0));
DefineGlobalColor("TermGray", CreateColor(100, 100, 100));
DefineGlobalColor("TermGold", CreateColor(255, 215, 0));
# ─── EXPANSION AREA SHIFT ENGINE ───
def lastDataBar = !IsNaN(close) and IsNaN(close[-1]);
def labelBar = lastDataBar[3];
# =====================================================================
# S1 — INTRADAY EMAs AND RIPSTER CLOUDS (10m)
# =====================================================================
def e50 = ExpAverage(hl2, 50);
AddCloud(if show10mClouds then ExpAverage(hl2, 5) else Double.NaN, ExpAverage(hl2, 12), CreateColor(76, 175, 80), CreateColor(244, 67, 54));
AddCloud(if show10mClouds then ExpAverage(hl2, 8) else Double.NaN, ExpAverage(hl2, 9), CreateColor(3, 97, 30), CreateColor(136, 14, 79));
AddCloud(if show10mClouds then ExpAverage(hl2, 20) else Double.NaN, ExpAverage(hl2, 21), CreateColor(107, 205, 117), CreateColor(230, 61, 19));
AddCloud(if show10mClouds then ExpAverage(hl2, 34) else Double.NaN, e50, CreateColor(33, 150, 243), CreateColor(255, 183, 77));
AddCloud(if show10mClouds then ExpAverage(hl2, 89) else Double.NaN, ExpAverage(hl2, 144), CreateColor(255, 0, 200), CreateColor(180, 0, 50));
# =====================================================================
# S2 — MACRO MTF EMA CLOUDS & ADAPTIVE REGIMES
# =====================================================================
def h1_close_c = close(period = AggregationPeriod.HOUR);
def h4_close_c = close(period = AggregationPeriod.FOUR_HOURS);
def d_close = close(period = AggregationPeriod.DAY);
def d_open = open(period = AggregationPeriod.DAY);
def w_close_c = close(period = AggregationPeriod.WEEK);
def w_open_c = open(period = AggregationPeriod.WEEK);
AddCloud(if showMacroClouds then ExpAverage(h1_close_c, 34) else Double.NaN, ExpAverage(h1_close_c, 50), CreateColor(255, 220, 50), CreateColor(160, 160, 160));
AddCloud(if showMacroClouds then ExpAverage(h4_close_c, 50) else Double.NaN, ExpAverage(h4_close_c, 55), CreateColor(100, 220, 130), CreateColor(140, 140, 140));
def macroSMA = Average(close, slopeLength);
def smaAngle = (ATan((macroSMA - macroSMA[slopeLookback]) / slopeLookback) * 180) / Double.Pi;
def htfBull = (d_close > d_open) and (ExpAverage(d_close, 8) > ExpAverage(d_close, 21));
def htfBear = (d_close < d_open) and (ExpAverage(d_close, 8) < ExpAverage(d_close, 21));
# =====================================================================
# S3 — HIDDEN MATRIX MATH (SILENT ENGINE & DUAL IMBALANCE)
# =====================================================================
def d_prev_H = high(period = AggregationPeriod.DAY)[1];
def d_prev_L = low(period = AggregationPeriod.DAY)[1];
def d_prev_C = close(period = AggregationPeriod.DAY)[1];
def w_prev_H = high(period = AggregationPeriod.WEEK)[1];
def w_prev_L = low(period = AggregationPeriod.WEEK)[1];
def sweepPDH = high > d_prev_H and close < d_prev_H; def sweepPDL = low < d_prev_L and close > d_prev_L;
def ema21 = ExpAverage(close, 21); def dev21 = StDev(close, 21);
def zScore = if dev21 > 0 then (close - ema21) / dev21 else 0;
def isOverbought = zScore >= 2.5; def isOversold = zScore <= -2.5;
def bbHalf = StDev(close, 20) * 2.0; def kcHalf = 1.5 * _ATR20; def isChop = bbHalf < kcHalf;
def cSpread = high - low; def avgSpread = Average(cSpread, 20);
def buyingPressure = if cSpread == 0 then 0 else ((close - low) / cSpread) * volume;
def sellingPressure = volume - buyingPressure;
def volImbalance = if volume > 0 then (buyingPressure - sellingPressure) / volume else 0;
def trendImbalance = Average(volImbalance, 3);
def volSMA = Average(volume, 20); def rvol = if volSMA > 0 then volume / volSMA else 1;
def isAnomaly = rvol >= 3.0;
def isBuyImbalance = volImbalance >= 0.40; def isSellImbalance = volImbalance <= -0.40;
def isTrendBuyImb = trendImbalance >= 0.25; def isTrendSellImb = trendImbalance <= -0.25;
def isIgnitionBull = isAnomaly and isBuyImbalance and cSpread > avgSpread * 1.5;
def isIgnitionBear = isAnomaly and isSellImbalance and cSpread > avgSpread * 1.5;
# =====================================================================
# S4 — QUANTUM ADAPTIVE RIBBON (KAMA) & VWAP MAGNET
# =====================================================================
def kamaLength = 10; def fastPeriod = 2; def slowPeriod = 30;
def momentum = AbsValue(close - close[kamaLength]);
def volatility = Sum(AbsValue(close - close[1]), kamaLength);
def ER = if volatility > 0 then momentum / volatility else 0;
def SC = Sqr(ER * (2.0 / 3.0 - 2.0 / 31.0) + 2.0 / 31.0);
rec KAMA = CompoundValue(1, KAMA[1] + SC * (close - KAMA[1]), close);
plot QuantumRibbon = if showKAMARibbon then KAMA else Double.NaN;
QuantumRibbon.SetPaintingStrategy(PaintingStrategy.LINE);
QuantumRibbon.SetLineWeight(3);
QuantumRibbon.AssignValueColor(if close >= KAMA then GlobalColor("TermCyan") else GlobalColor("TermMagenta"));
QuantumRibbon.HideBubble();
def atr_Long = close >= KAMA; def atr_Short = close < KAMA;
plot dailyVWAP = if showVwapMagnet then vwap(period = AggregationPeriod.DAY) else Double.NaN;
dailyVWAP.SetPaintingStrategy(PaintingStrategy.DASHES);
dailyVWAP.SetDefaultColor(CreateColor(120, 120, 120));
dailyVWAP.HideBubble();
# =====================================================================
# S5 — MACRO STRAT ENGINE (GATED CONFLUENCE)
# =====================================================================
def FTFC_Bull = close > d_open and close > w_open_c;
def FTFC_Bear = close < d_open and close < w_open_c;
def Flow_Bull = trendImbalance > 0.10; def Flow_Bear = trendImbalance < -0.10;
def gateBull = FTFC_Bull and Flow_Bull and !isChop;
def gateBear = FTFC_Bear and Flow_Bear and !isChop;
def p30m = 3; def p30m_recH = Highest(high[1], p30m); def p30m_recL = Lowest(low[1], p30m);
def trig30m_2U = p30m_recH[1] < Highest(high[p30m + 2], p30m) and high > p30m_recH[1] and high[1] <= p30m_recH[1];
def trig30m_2D = p30m_recL[1] > Lowest(low[p30m + 2], p30m) and low < p30m_recL[1] and low[1] >= p30m_recL[1];
def p1 = 6; def p1_recH = Highest(high[1], p1); def p1_recL = Lowest(low[1], p1);
def trig1H_2U = p1_recH[1] < Highest(high[p1 + 2], p1) and high > p1_recH[1] and high[1] <= p1_recH[1];
def trig1H_2D = p1_recL[1] > Lowest(low[p1 + 2], p1) and low < p1_recL[1] and low[1] >= p1_recL[1];
AddChartBubble(showMacroStrat and gateBull and trig30m_2U, low - (_ATR14 * 0.1), "30m: 2U", GlobalColor("TermCyan"), no);
AddChartBubble(showMacroStrat and gateBear and trig30m_2D, high + (_ATR14 * 0.1), "30m: 2D", GlobalColor("TermMagenta"), yes);
AddChartBubble(showMacroStrat and gateBull and trig1H_2U, low - (_ATR14 * 0.2), "1H: 2U", GlobalColor("TermCyan"), no);
AddChartBubble(showMacroStrat and gateBear and trig1H_2D, high + (_ATR14 * 0.2), "1H: 2D", GlobalColor("TermMagenta"), yes);
# =====================================================================
# S6 — 4-TIER BAYESIAN MATRIX & 3-BAR TREND ARMOR FILTER
# =====================================================================
def isInside_10m = high <= high[1] and low >= low[1]; def isOutside_10m = high > high[1] and low < low[1];
def is2Up_10m = high > high[1] and low >= low[1]; def is2Down_10m = low < low[1] and high <= high[1];
def micro_Bull = (is2Down_10m[1] and is2Up_10m) or (isInside_10m[1] and is2Up_10m) or (isOutside_10m[1] and is2Up_10m);
def micro_Bear = (is2Up_10m[1] and is2Down_10m) or (isInside_10m[1] and is2Down_10m) or (isOutside_10m[1] and is2Down_10m);
def momWeight = if !isChop then 40 else 20; def revWeight = if isChop then 50 else 10; def volWeight = 30;
def trendBullScore = (if htfBull then momWeight else 0) + (if atr_Long then 20 else 0) + (if isIgnitionBull then volWeight else 0) + (if micro_Bull then 10 else 0);
def trendBearScore = (if htfBear then momWeight else 0) + (if atr_Short then 20 else 0) + (if isIgnitionBear then volWeight else 0) + (if micro_Bear then 10 else 0);
def chopBullScore = (if isOversold or sweepPDL then revWeight else 0) + (if isBuyImbalance then 10 else 0) + (if micro_Bull then 10 else 0);
def chopBearScore = (if isOverbought or sweepPDH then revWeight else 0) + (if isSellImbalance then 10 else 0) + (if micro_Bear then 10 else 0);
def totalBull = if isChop or isOversold or sweepPDL then chopBullScore else trendBullScore;
def totalBear = if isChop or isOverbought or sweepPDH then chopBearScore else trendBearScore;
def mScore = Max(totalBull, totalBear);
def rawBull_APlus = totalBull >= 90 and micro_Bull; def rawBull_A = totalBull >= 80 and totalBull < 90 and micro_Bull;
def rawBull_AMin = totalBull >= 70 and totalBull < 80 and micro_Bull; def rawBull_BPlus = totalBull >= 60 and totalBull < 70 and micro_Bull;
def rawBear_APlus = totalBear >= 90 and micro_Bear; def rawBear_A = totalBear >= 80 and totalBear < 90 and micro_Bear;
def rawBear_AMin = totalBear >= 70 and totalBear < 80 and micro_Bear; def rawBear_BPlus = totalBear >= 60 and totalBear < 70 and micro_Bear;
def trailingLow3 = Lowest(low[1], 3); def trailingHigh3 = Highest(high[1], 3);
rec trendLock = if rawBull_APlus then 1 else if rawBear_APlus then -1 else trendLock[1];
def isSafeLong = trendLock[1] == 1 and close >= trailingLow3;
def isSafeShort = trendLock[1] == -1 and close <= trailingHigh3;
plot TrendRider = if showTrendArmor then (if trendLock == 1 then trailingLow3 else if trendLock == -1 then trailingHigh3 else Double.NaN) else Double.NaN;
TrendRider.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
TrendRider.AssignValueColor(if trendLock == 1 then GlobalColor("TermCyan") else GlobalColor("TermMagenta"));
TrendRider.SetLineWeight(2);
def execBull_APlus = rawBull_APlus and !isSafeShort; def execBull_A = rawBull_A and !isSafeShort;
def execBull_AMin = rawBull_AMin and !isSafeShort; def execBull_BPlus = rawBull_BPlus and !isSafeShort;
def execBear_APlus = rawBear_APlus and !isSafeLong; def execBear_A = rawBear_A and !isSafeLong;
def execBear_AMin = rawBear_AMin and !isSafeLong; def execBear_BPlus = rawBear_BPlus and !isSafeLong;
AssignPriceColor(if isChop then GlobalColor("TermGray") else if atr_Long then GlobalColor("TermCyan") else if atr_Short then GlobalColor("TermMagenta") else GlobalColor("TermGray"));
AddChartBubble(execBull_APlus, low - (_ATR14 * 1.0), "[ A+ ]", GlobalColor("TermCyan"), no);
AddChartBubble(execBull_A, low - (_ATR14 * 1.0), "[ A ]", GlobalColor("TermCyan"), no);
AddChartBubble(execBull_AMin, low - (_ATR14 * 1.0), "[ A- ]", GlobalColor("TermCyan"), no);
AddChartBubble(execBull_BPlus, low - (_ATR14 * 1.0), "[ B+ ]", GlobalColor("TermCyan"), no);
AddChartBubble(execBear_APlus, high + (_ATR14 * 1.0), "[ A+ ]", GlobalColor("TermMagenta"), yes);
AddChartBubble(execBear_A, high + (_ATR14 * 1.0), "[ A ]", GlobalColor("TermMagenta"), yes);
AddChartBubble(execBear_AMin, high + (_ATR14 * 1.0), "[ A- ]", GlobalColor("TermMagenta"), yes);
AddChartBubble(execBear_BPlus, high + (_ATR14 * 1.0), "[ B+ ]", GlobalColor("TermMagenta"), yes);
# =====================================================================
# S13 — VOLUME IMBALANCE DIVERGENCE ENGINE (DOTS EDITION)
# =====================================================================
def swingHigh = high > high[1] and high > high[2] and high >= high[-1];
def swingLow = low < low[1] and low < low[2] and low <= low[-1];
rec lastSwingHighPrice = if swingHigh then high else lastSwingHighPrice[1];
rec lastSwingHighImb = if swingHigh then trendImbalance else lastSwingHighImb[1];
rec lastSwingLowPrice = if swingLow then low else lastSwingLowPrice[1];
rec lastSwingLowImb = if swingLow then trendImbalance else lastSwingLowImb[1];
# Bearish Divergence: Price makes higher high, but volume imbalance makes lower high
def isBearDiv = swingHigh and high > lastSwingHighPrice[1] and trendImbalance < lastSwingHighImb[1];
# Bullish Divergence: Price makes lower low, but volume imbalance makes higher low
def isBullDiv = swingLow and low < lastSwingLowPrice[1] and trendImbalance > lastSwingLowImb[1];
plot BullDivergence = if showImbDivergences and isBullDiv then low - (_ATR14 * 0.5) else Double.NaN;
BullDivergence.SetPaintingStrategy(PaintingStrategy.POINTS);
BullDivergence.SetDefaultColor(CreateColor(0, 255, 0));
BullDivergence.SetLineWeight(4);
plot BearDivergence = if showImbDivergences and isBearDiv then high + (_ATR14 * 0.5) else Double.NaN;
BearDivergence.SetPaintingStrategy(PaintingStrategy.POINTS);
BearDivergence.SetDefaultColor(CreateColor(255, 0, 0));
BearDivergence.SetLineWeight(4);
# =====================================================================
# S7 — FULL SATY FIBONACCI TARGETS RESTORED (.382, .50, .618, .786, 1.0)
# =====================================================================
def currentIV = if IsNaN(ImpVolatility()) then 0 else ImpVolatility();
def raw_ivMove = d_prev_C * currentIV * Sqrt(1.0 / 252.0);
def raw_atrMove = WildersAverage(TrueRange(d_prev_H, d_prev_C, d_prev_L), 14);
def raw_volBase = Max(if IsNaN(raw_ivMove) then 0 else raw_ivMove, if IsNaN(raw_atrMove) then 0 else raw_atrMove);
rec ext_d_prev_C = if !IsNaN(close) then d_prev_C else ext_d_prev_C[1];
rec ext_volBase = if !IsNaN(close) then raw_volBase else ext_volBase[1];
def isToday = GetDay() == GetLastDay();
plot Fib_Up_382 = if showQuantumTargets and isToday then ext_d_prev_C + (ext_volBase * 0.382) else Double.NaN;
plot Fib_Up_500 = if showQuantumTargets and isToday then ext_d_prev_C + (ext_volBase * 0.500) else Double.NaN;
plot Fib_Up_618 = if showQuantumTargets and isToday then ext_d_prev_C + (ext_volBase * 0.618) else Double.NaN;
plot Fib_Up_786 = if showQuantumTargets and isToday then ext_d_prev_C + (ext_volBase * 0.786) else Double.NaN;
plot Fib_Up_100 = if showQuantumTargets and isToday then ext_d_prev_C + (ext_volBase * 1.000) else Double.NaN;
Fib_Up_382.SetDefaultColor(GlobalColor("TermCyan")); Fib_Up_382.SetStyle(Curve.SHORT_DASH); Fib_Up_382.HideBubble();
Fib_Up_500.SetDefaultColor(GlobalColor("TermCyan")); Fib_Up_500.SetStyle(Curve.SHORT_DASH); Fib_Up_500.HideBubble();
Fib_Up_618.SetDefaultColor(GlobalColor("TermCyan")); Fib_Up_618.SetStyle(Curve.FIRM); Fib_Up_618.SetLineWeight(2); Fib_Up_618.HideBubble();
Fib_Up_786.SetDefaultColor(GlobalColor("TermCyan")); Fib_Up_786.SetStyle(Curve.SHORT_DASH); Fib_Up_786.HideBubble();
Fib_Up_100.SetDefaultColor(Color.WHITE); Fib_Up_100.SetStyle(Curve.FIRM); Fib_Up_100.SetLineWeight(2); Fib_Up_100.HideBubble();
plot Fib_Dn_382 = if showQuantumTargets and isToday then ext_d_prev_C - (ext_volBase * 0.382) else Double.NaN;
plot Fib_Dn_500 = if showQuantumTargets and isToday then ext_d_prev_C - (ext_volBase * 0.500) else Double.NaN;
plot Fib_Dn_618 = if showQuantumTargets and isToday then ext_d_prev_C - (ext_volBase * 0.618) else Double.NaN;
plot Fib_Dn_786 = if showQuantumTargets and isToday then ext_d_prev_C - (ext_volBase * 0.786) else Double.NaN;
plot Fib_Dn_100 = if showQuantumTargets and isToday then ext_d_prev_C - (ext_volBase * 1.000) else Double.NaN;
Fib_Dn_382.SetDefaultColor(GlobalColor("TermMagenta")); Fib_Dn_382.SetStyle(Curve.SHORT_DASH); Fib_Dn_382.HideBubble();
Fib_Dn_500.SetDefaultColor(GlobalColor("TermMagenta")); Fib_Dn_500.SetStyle(Curve.SHORT_DASH); Fib_Dn_500.HideBubble();
Fib_Dn_618.SetDefaultColor(GlobalColor("TermMagenta")); Fib_Dn_618.SetStyle(Curve.FIRM); Fib_Dn_618.SetLineWeight(2); Fib_Dn_618.HideBubble();
Fib_Dn_786.SetDefaultColor(GlobalColor("TermMagenta")); Fib_Dn_786.SetStyle(Curve.SHORT_DASH); Fib_Dn_786.HideBubble();
Fib_Dn_100.SetDefaultColor(Color.WHITE); Fib_Dn_100.SetStyle(Curve.FIRM); Fib_Dn_100.SetLineWeight(2); Fib_Dn_100.HideBubble();
AddChartBubble(showQuantumTargets and labelBar, Fib_Up_382, ".382 FIB", GlobalColor("TermCyan"), yes);
AddChartBubble(showQuantumTargets and labelBar, Fib_Up_500, ".50 FIB", GlobalColor("TermCyan"), yes);
AddChartBubble(showQuantumTargets and labelBar, Fib_Up_618, ".618 FIB", GlobalColor("TermCyan"), yes);
AddChartBubble(showQuantumTargets and labelBar, Fib_Up_786, ".786 FIB", GlobalColor("TermCyan"), yes);
AddChartBubble(showQuantumTargets and labelBar, Fib_Up_100, "1.0 FIB", Color.WHITE, yes);
AddChartBubble(showQuantumTargets and labelBar, Fib_Dn_382, ".382 FIB", GlobalColor("TermMagenta"), no);
AddChartBubble(showQuantumTargets and labelBar, Fib_Dn_500, ".50 FIB", GlobalColor("TermMagenta"), no);
AddChartBubble(showQuantumTargets and labelBar, Fib_Dn_618, ".618 FIB", GlobalColor("TermMagenta"), no);
AddChartBubble(showQuantumTargets and labelBar, Fib_Dn_786, ".786 FIB", GlobalColor("TermMagenta"), no);
AddChartBubble(showQuantumTargets and labelBar, Fib_Dn_100, "1.0 FIB", Color.WHITE, no);
# =====================================================================
# S8 — DYNAMIC S/D (FRAMED INSTITUTIONAL BOXES)
# =====================================================================
rec supTop = if isIgnitionBear then high[1] else if !IsNaN(supTop[1]) and close > supTop[1] then Double.NaN else supTop[1];
rec supBtm = if isIgnitionBear then Min(open[1], close[1]) else if !IsNaN(supTop[1]) and close > supTop[1] then Double.NaN else supBtm[1];
rec demBtm = if isIgnitionBull then low[1] else if !IsNaN(demBtm[1]) and close < demBtm[1] then Double.NaN else demBtm[1];
rec demTop = if isIgnitionBull then Max(open[1], close[1]) else if !IsNaN(demBtm[1]) and close < demBtm[1] then Double.NaN else demTop[1];
plot SD_Sup_Top = if showDynamicSD then supTop else Double.NaN;
plot SD_Sup_Btm = if showDynamicSD then supBtm else Double.NaN;
SD_Sup_Top.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); SD_Sup_Top.SetDefaultColor(GlobalColor("TermMagenta")); SD_Sup_Top.SetLineWeight(1); SD_Sup_Top.HideBubble();
SD_Sup_Btm.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); SD_Sup_Btm.SetDefaultColor(GlobalColor("TermMagenta")); SD_Sup_Btm.SetLineWeight(1); SD_Sup_Btm.HideBubble();
plot SD_Dem_Top = if showDynamicSD then demTop else Double.NaN;
plot SD_Dem_Btm = if showDynamicSD then demBtm else Double.NaN;
SD_Dem_Top.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); SD_Dem_Top.SetDefaultColor(GlobalColor("TermCyan")); SD_Dem_Top.SetLineWeight(1); SD_Dem_Top.HideBubble();
SD_Dem_Btm.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); SD_Dem_Btm.SetDefaultColor(GlobalColor("TermCyan")); SD_Dem_Btm.SetLineWeight(1); SD_Dem_Btm.HideBubble();
AddCloud(SD_Sup_Top, SD_Sup_Btm, CreateColor(50, 0, 50), CreateColor(50, 0, 50));
AddCloud(SD_Dem_Top, SD_Dem_Btm, CreateColor(0, 50, 50), CreateColor(0, 50, 50));
# =====================================================================
# S9 — YELLOW GOLDEN POCKET RELOAD ZONES (FROZEN)
# =====================================================================
def anyBull = execBull_APlus or execBull_A or execBull_AMin or execBull_BPlus;
def anyBear = execBear_APlus or execBear_A or execBear_AMin or execBear_BPlus;
rec ext_trendState = if !IsNaN(close) then trendLock else ext_trendState[1];
rec swingLowBull = if anyBull and trendLock[1] != 1 then Lowest(low, 8) else if trendLock == 1 then swingLowBull[1] else Double.NaN;
rec peakHighBull = if anyBull and trendLock[1] != 1 then high else if trendLock == 1 then Max(high, peakHighBull[1]) else Double.NaN;
rec ext_peakHighBull = if !IsNaN(close) then peakHighBull else ext_peakHighBull[1];
rec ext_rangeBull = if !IsNaN(close) then (peakHighBull - swingLowBull) else ext_rangeBull[1];
rec swingHighBear = if anyBear and trendLock[1] != -1 then Highest(high, 8) else if trendLock == -1 then swingHighBear[1] else Double.NaN;
rec peakLowBear = if anyBear and trendLock[1] != -1 then low else if trendLock == -1 then Min(low, peakLowBear[1]) else Double.NaN;
rec ext_peakLowBear = if !IsNaN(close) then peakLowBear else ext_peakLowBear[1];
rec ext_rangeBear = if !IsNaN(close) then (swingHighBear - peakLowBear) else ext_rangeBear[1];
plot Bull_Reload_618 = if showReloadZones and ext_trendState == 1 and ext_rangeBull > 0 then ext_peakHighBull - (ext_rangeBull * 0.618) else Double.NaN;
plot Bull_Reload_786 = if showReloadZones and ext_trendState == 1 and ext_rangeBull > 0 then ext_peakHighBull - (ext_rangeBull * 0.786) else Double.NaN;
Bull_Reload_618.SetDefaultColor(GlobalColor("TermGold")); Bull_Reload_618.SetStyle(Curve.SHORT_DASH); Bull_Reload_618.HideBubble();
Bull_Reload_786.SetDefaultColor(GlobalColor("TermGold")); Bull_Reload_786.SetStyle(Curve.SHORT_DASH); Bull_Reload_786.HideBubble();
plot Bear_Reload_618 = if showReloadZones and ext_trendState == -1 and ext_rangeBear > 0 then ext_peakLowBear + (ext_rangeBear * 0.618) else Double.NaN;
plot Bear_Reload_786 = if showReloadZones and ext_trendState == -1 and ext_rangeBear > 0 then ext_peakLowBear + (ext_rangeBear * 0.786) else Double.NaN;
Bear_Reload_618.SetDefaultColor(GlobalColor("TermGold")); Bear_Reload_618.SetStyle(Curve.SHORT_DASH); Bear_Reload_618.HideBubble();
Bear_Reload_786.SetDefaultColor(GlobalColor("TermGold")); Bear_Reload_786.SetStyle(Curve.SHORT_DASH); Bear_Reload_786.HideBubble();
AddCloud(Bull_Reload_618, Bull_Reload_786, CreateColor(80, 60, 0), CreateColor(80, 60, 0));
AddCloud(Bear_Reload_618, Bear_Reload_786, CreateColor(80, 60, 0), CreateColor(80, 60, 0));
AddChartBubble(showReloadZones and labelBar and ext_trendState == 1, Bull_Reload_618, "GOLDEN POCKET", GlobalColor("TermGold"), yes);
AddChartBubble(showReloadZones and labelBar and ext_trendState == -1, Bear_Reload_618, "GOLDEN POCKET", GlobalColor("TermGold"), no);
# =====================================================================
# S10 — TIME-BASED FORWARD PROJECTIONS (FROZEN FOR EXPANSION)
# =====================================================================
def raw_o1H = open(period = AggregationPeriod.HOUR);
def raw_o4H = open(period = AggregationPeriod.FOUR_HOURS);
def raw_oD = open(period = AggregationPeriod.DAY);
rec ext_o1H = if !IsNaN(close) then raw_o1H else ext_o1H[1];
rec ext_o4H = if !IsNaN(close) then raw_o4H else ext_o4H[1];
rec ext_oD = if !IsNaN(close) then raw_oD else ext_oD[1];
def raw_atr1H = Average(TrueRange(high(period = AggregationPeriod.HOUR), close(period = AggregationPeriod.HOUR)[1], low(period = AggregationPeriod.HOUR)), 14);
def raw_atr4H = Average(TrueRange(high(period = AggregationPeriod.FOUR_HOURS), close(period = AggregationPeriod.FOUR_HOURS)[1], low(period = AggregationPeriod.FOUR_HOURS)), 14);
def raw_atrD = Average(TrueRange(d_prev_H, d_prev_C, d_prev_L), 14);
rec ext_atr1H = if !IsNaN(close) then raw_atr1H else ext_atr1H[1];
rec ext_atr4H = if !IsNaN(close) then raw_atr4H else ext_atr4H[1];
rec ext_atrD = if !IsNaN(close) then raw_atrD else ext_atrD[1];
plot Proj_1H_Up = if showMTFProjections and isToday then ext_o1H + ext_atr1H else Double.NaN;
plot Proj_1H_Dn = if showMTFProjections and isToday then ext_o1H - ext_atr1H else Double.NaN;
Proj_1H_Up.SetPaintingStrategy(PaintingStrategy.SQUARES); Proj_1H_Up.SetDefaultColor(CreateColor(100, 180, 255)); Proj_1H_Up.HideBubble();
Proj_1H_Dn.SetPaintingStrategy(PaintingStrategy.SQUARES); Proj_1H_Dn.SetDefaultColor(CreateColor(100, 180, 255)); Proj_1H_Dn.HideBubble();
plot Proj_4H_Up = if showMTFProjections and isToday then ext_o4H + ext_atr4H else Double.NaN;
plot Proj_4H_Dn = if showMTFProjections and isToday then ext_o4H - ext_atr4H else Double.NaN;
Proj_4H_Up.SetPaintingStrategy(PaintingStrategy.SQUARES); Proj_4H_Up.SetDefaultColor(CreateColor(200, 150, 255)); Proj_4H_Up.HideBubble();
Proj_4H_Dn.SetPaintingStrategy(PaintingStrategy.SQUARES); Proj_4H_Dn.SetDefaultColor(CreateColor(200, 150, 255)); Proj_4H_Dn.HideBubble();
plot Proj_D_Up = if showMTFProjections and isToday then ext_oD + ext_atrD else Double.NaN;
plot Proj_D_Dn = if showMTFProjections and isToday then ext_oD - ext_atrD else Double.NaN;
Proj_D_Up.SetPaintingStrategy(PaintingStrategy.SQUARES); Proj_D_Up.SetDefaultColor(Color.WHITE); Proj_D_Up.HideBubble();
Proj_D_Dn.SetPaintingStrategy(PaintingStrategy.SQUARES); Proj_D_Dn.SetDefaultColor(Color.WHITE); Proj_D_Dn.HideBubble();
AddChartBubble(showMTFProjections and labelBar, Proj_1H_Up, "1H PROJ", CreateColor(100, 180, 255), yes);
AddChartBubble(showMTFProjections and labelBar, Proj_1H_Dn, "1H PROJ", CreateColor(100, 180, 255), no);
AddChartBubble(showMTFProjections and labelBar, Proj_4H_Up, "4H PROJ", CreateColor(200, 150, 255), yes);
AddChartBubble(showMTFProjections and labelBar, Proj_4H_Dn, "4H PROJ", CreateColor(200, 150, 255), no);
AddChartBubble(showMTFProjections and labelBar, Proj_D_Up, "D PROJ", Color.WHITE, yes);
AddChartBubble(showMTFProjections and labelBar, Proj_D_Dn, "D PROJ", Color.WHITE, no);
# =====================================================================
# S11 — DUAL IMBALANCE DASHBOARD & LEVEL LABELS
# =====================================================================
def dominantColor = if totalBull >= totalBear then 1 else -1;
AddLabel(yes, " SCORE: " + mScore + "/100 ", if mScore >= 70 and dominantColor == 1 then GlobalColor("TermCyan") else if mScore >= 70 and dominantColor == -1 then GlobalColor("TermMagenta") else GlobalColor("TermGray"));
AddLabel(yes, " SYS: " + (if isChop then "SQUEEZE " else if atr_Long then "BULL TREND " else "BEAR TREND ") + " ", if isChop then GlobalColor("TermGray") else Color.WHITE);
AddLabel(yes, " [ LIVE IMB ]: " + Round(volImbalance * 100, 1) + "% ", if isBuyImbalance then GlobalColor("TermCyan") else if isSellImbalance then GlobalColor("TermMagenta") else GlobalColor("TermGray"));
AddLabel(yes, " [ 3-BAR IMB ]: " + Round(trendImbalance * 100, 1) + "% ", if isTrendBuyImb then GlobalColor("TermCyan") else if isTrendSellImb then GlobalColor("TermMagenta") else GlobalColor("TermGray"));
AddLabel(yes, " PDH: " + Round(d_prev_H, 2) + " ", if close > d_prev_H then GlobalColor("TermCyan") else GlobalColor("TermMagenta"));
AddLabel(yes, " PDL: " + Round(d_prev_L, 2) + " ", if close > d_prev_L then GlobalColor("TermCyan") else GlobalColor("TermMagenta"));
AddLabel(yes, " PWH: " + Round(w_prev_H, 2) + " ", if close > w_prev_H then GlobalColor("TermCyan") else GlobalColor("TermMagenta"));
AddLabel(yes, " PWL: " + Round(w_prev_L, 2) + " ", if close > w_prev_L then GlobalColor("TermCyan") else GlobalColor("TermMagenta"));
# =====================================================================
# S12 — QUARANTINED TERMINAL ALERTS
# =====================================================================
Alert(enableAudioAlerts and execBull_APlus, "A+ BULLISH EXECUTION", Alert.BAR, Sound.Chimes);
Alert(enableAudioAlerts and execBear_APlus, "A+ BEARISH EXECUTION", Alert.BAR, Sound.Bell);
Last edited by a moderator: